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

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 3 04:30:46 UTC 2011


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

Comment (by dd32):

 mikeschinkel: It's actually very simple.

 You register a "Endpoint" with a Endpoint Mask.
 {{{
 add_rewrite_endpoint( 'json', EP_ROOT ^ EP_PERMALINK ^ EP_ALL_ARCHIVES );
 }}}
 If you understand Binary mathematics, it's a lot easier, as it's using
 Bitwise comparisons ( [http://www.litfuel.net/tutorials/bitwise.htm this
 site] seems to give a reasonable overview of it)

 Each set of rewrite rules that is generated by core is given a Endpoint
 Mask(a bitmask), for example, posts get EP_PERMALINK, If the bits set in
 EP_PERMALINK is "equal to" the bits in the specified endpoint mask, then
 that endpoint is added to the rules generated.

 Note, that Custom Post Types by default get given _no_ endpoint mask, you
 can set it when you register the post type, but for best results, it
 should be a unique number (well, power of 2) global to the install, this
 is a bit hard to track and I've personally just ended up using stupidly
 high numbers (2^40 for example) as masks.

 westi: That patch looks like it's missing a file? You've defined the
 bitmask, but never actually used it?

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


More information about the wp-trac mailing list