Allow for a custom Endpoint Mask to be passed to add_endpoint(). Allows for endpoints to be targeted to specific rewrite rules. Allow custom post_types to specify their Endpoint mask. Allows for post_type's rewrite rules to inherit Post endpoints, or alternatively, allows for add_endpoint() to target specific post_types. Fixes #12605
git-svn-id: http://svn.automattic.com/wordpress/trunk@13773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -790,7 +790,7 @@ function register_post_type($post_type, $args = array()) {
|
||||
$wp_post_types = array();
|
||||
|
||||
// Args prefixed with an underscore are reserved for internal use.
|
||||
$defaults = array('label' => false, 'singular_label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null );
|
||||
$defaults = array('label' => false, 'singular_label' => false, 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null, 'permalink_epmask' => EP_NONE );
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
$args = (object) $args;
|
||||
|
||||
@@ -855,7 +855,7 @@ function register_post_type($post_type, $args = array()) {
|
||||
if ( !isset($args->rewrite['with_front']) )
|
||||
$args->rewrite['with_front'] = true;
|
||||
$wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
|
||||
$wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front']);
|
||||
$wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);
|
||||
}
|
||||
|
||||
if ( $args->register_meta_box_cb )
|
||||
@@ -4580,4 +4580,4 @@ function _show_post_preview() {
|
||||
|
||||
add_filter('the_preview', '_set_preview');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user