[wp-trac] [WordPress Trac] #16303: Improve documentation and usability of WP_Rewrite Endpoint support

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 26 17:32:52 UTC 2012


#16303: Improve documentation and usability of WP_Rewrite Endpoint support
-------------------------------------------------+-------------------------
 Reporter:  westi                                |       Owner:  westi
     Type:  defect (bug)                         |      Status:  new
 Priority:  lowest                               |   Milestone:  Future
Component:  Rewrite Rules                        |  Release
 Severity:  normal                               |     Version:  3.1
 Keywords:  westi-likes has-patch commit dev-    |  Resolution:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by duck_):

 Replying to [comment:19 lgedeon]:
 > Here is another example that might help with documenting end-points:
 >
 > This code adds an endpoint of the form /embed/xxxx/ to the end of any
 post. We then load a separate template to render the article in one of
 several embeddable formats.

 Just a couple of notes:

  * You shouldn't pass an array as $places to add_rewrite_endpoint(). AFAIK
 the binary representation of an array is "1" so it works for EP_PERMALINK,
 but try the same code but with EP_PAGES and it will still add the endpoint
 to post permalinks. This was a documentation error previously.
  * WP_Rewrite::add_endpoint() will add the query var for you. I guess that
 since you're hooking into admin_init to add_rewrite_endpoint() it's not
 going to work unless you hook into init instead.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16303#comment:20>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list