From c15c6f2b23bdb0f4d2f08e6db97daca81c87948b Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 9 Mar 2011 05:18:45 +0000 Subject: [PATCH] Prevent double index.php preprend on PATHINFO custom taxonomy permalinks. Proper use of with_front. props greuben. fixes #16918. fixes #16622. see #15813. see #12659. For trunk git-svn-id: https://develop.svn.wordpress.org/trunk@17512 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/taxonomy.php | 8 +++++--- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 80529d5748..957ce724d6 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -15,6 +15,8 @@ * Creates the initial taxonomies when 'init' action is fired. */ function create_initial_taxonomies() { + global $wp_rewrite; + register_taxonomy( 'category', 'post', array( 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', @@ -22,7 +24,7 @@ function create_initial_taxonomies() { 'rewrite' => did_action( 'init' ) ? array( 'hierarchical' => true, 'slug' => get_option('category_base') ? get_option('category_base') : 'category', - 'with_front' => false) : false, + 'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false, 'public' => true, 'show_ui' => true, '_builtin' => true, @@ -34,7 +36,7 @@ function create_initial_taxonomies() { 'query_var' => 'tag', 'rewrite' => did_action( 'init' ) ? array( 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', - 'with_front' => false) : false, + 'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false, 'public' => true, 'show_ui' => true, '_builtin' => true, @@ -329,7 +331,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, "{$wp_rewrite->root}{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']); + $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']); } if ( is_null($args['show_ui']) ) diff --git a/wp-includes/version.php b/wp-includes/version.php index b42253028e..b3c63d057a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -29,7 +29,7 @@ $wp_version = '3.2-bleeding'; * * @global int $wp_db_version */ -$wp_db_version = 17056; +$wp_db_version = 17510; /** * Holds the TinyMCE version