From 2f4c5457614c8d6787ba4dc6abac828d4d70fb4d Mon Sep 17 00:00:00 2001 From: duck_ Date: Sat, 28 Jan 2012 21:00:59 +0000 Subject: [PATCH] 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 --- wp-includes/post.php | 2 +- wp-includes/rewrite.php | 1 + wp-includes/taxonomy.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 4c2a32e77..2bdd51ba1 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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 ) diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 7d2abad7b..82f1114a6 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -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'] ) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index f04892619..5f377f674 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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']) )