[wp-trac] [WordPress Trac] #12779: Better support for custom post types in WP_Rewrite

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 30 20:04:30 UTC 2010


#12779: Better support for custom post types in WP_Rewrite
----------------------------+-----------------------------------------------
 Reporter:  nacin           |       Owner:  ryan
     Type:  task (blessed)  |      Status:  new 
 Priority:  normal          |   Milestone:  3.0 
Component:  Rewrite Rules   |     Version:      
 Severity:  normal          |    Keywords:      
----------------------------+-----------------------------------------------
 See also #12605 and [13773].

 We currently use bitmasks in WP_Rewrite, which we should remove and
 convert to an array of URL types that can be checked using in_array(). We
 currently do not use bitmask operations in WP_Rewrite that would make them
 preferable for use.

 To currently use custom post types with endpoints, a plugin would need to
 do the following, from [comment:5:ticket:12605 dd32 in #12605]:
 {{{
 define('EP_WIKI', 131072); // 2^17. 2^13 is used by core.
 register_post_type('wiki', array(
         'label' => __('Wiki'),
         'public' => true,
         'supports' => array('revisions', 'editor', 'title'),
         'permalink_epmask' => EP_WIKI,
         'hierarchical' => true
 ));
 add_rewrite_endpoint('history', EP_WIKI);
 }}}

 In particular:
 > Care would need to be taken that any custom endpoints are in 2^x format,
 and not currently in use by any other plugins loaded.

 This would need to be backwards compatible with the existing bitmasks.
 More or less, {{{WP_Rewrite::add_endpoint()}}} would need to still take
 bitmasks and convert them to the new format.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12779>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list