Use new $args parameter for (WP_Rewrite::)add_permastruct(). Fixes #16092.
Use array_intersect_key() to keep WP_Rewrite::$extra_permastructs free of unnecessary/unknown keys + values. git-svn-id: http://svn.automattic.com/wordpress/trunk@19779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
779cf2bad5
commit
2f4c545761
|
@ -1027,7 +1027,7 @@ function register_post_type($post_type, $args = array()) {
|
|||
$wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
|
||||
}
|
||||
|
||||
$wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->rewrite['ep_mask'] );
|
||||
$wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
|
||||
}
|
||||
|
||||
if ( $args->register_meta_box_cb )
|
||||
|
|
|
@ -1913,6 +1913,7 @@ class WP_Rewrite {
|
|||
'walk_dirs' => true,
|
||||
'endpoints' => true,
|
||||
);
|
||||
$args = array_intersect_key( $args, $defaults );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
if ( $args['with_front'] )
|
||||
|
|
|
@ -344,7 +344,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
|||
$tag = '([^/]+)';
|
||||
|
||||
$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
|
||||
$wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front'], $args['rewrite']['ep_mask'] );
|
||||
$wp_rewrite->add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
|
||||
}
|
||||
|
||||
if ( is_null($args['show_ui']) )
|
||||
|
|
Loading…
Reference in New Issue