From 6a7fe5b25c42b4e931f0447da312b564936f87b1 Mon Sep 17 00:00:00 2001 From: Jon Cave 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: https://develop.svn.wordpress.org/trunk@19779 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 4c2a32e77c..2bdd51ba1f 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 7d2abad7b2..82f1114a6b 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 f04892619b..5f377f6748 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']) )