From afdda66384d93a9a1d772d95cbc39e8c92c8be84 Mon Sep 17 00:00:00 2001 From: markjaquith 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: http://svn.automattic.com/wordpress/trunk@17512 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 80529d574..957ce724d 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 b42253028..b3c63d057 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