Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Custom additions to permalinks for any kind of type (archives, posts, root).

Endpoints should be registered on init with:

add_rewrite_endpoint( $name, $places );


  • $name – The name for the endpoint, example: api.
  • $places – Where the endpoint should be registered. There are some fixed constants, you should use:
    • EP_NONE – Nowhere. Rather pointless.
    • EP_PERMALINK – Permalinks for singular posts.
    • EP_ATTACHMENT – Attachments.
    • EP_DATE – Date archives
    • EP_YEAR – Year archives
    • EP_MONTH – Month archives
    • EP_DAY – Day archives
    • EP_ROOT – Front page
    • EP_COMMENTS – Comment pages
    • EP_SEARCH – Search results
    • EP_CATEGORIES – Category archives
    • EP_TAGS – Tag archives
    • EP_AUTHORS – Author archives
    • EP_PAGES – Pages
    • EP_ALL – Everywhere

You can combine multiple places with bitwise operators. To add an endpoint to search and author pages:

add_rewrite_endpoint( 'api', EP_SEARCH | EP_AUTHORS );

Make sure to flush the rewrite once with flush_rewrite_rules( FALSE ); after you registered the endpoint.

history | excerpt history