Better support for custom post types in WP_Rewrite
|Reported by:||nacin||Owned by:|
|Component:||Rewrite Rules||Keywords:||has-patch needs-refresh|
Description (last modified by nacin)
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 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);
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.
Change History (16)
- Milestone changed from Awaiting Triage to Future Release
- Type changed from task (blessed) to feature request