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 3.1

git-svn-id: http://svn.automattic.com/wordpress/branches/3.1@17513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2011-03-09 05:19:20 +00:00
parent 5e09c87f1d
commit fc28e3f83f
2 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,8 @@
* Creates the initial taxonomies when 'init' action is fired. * Creates the initial taxonomies when 'init' action is fired.
*/ */
function create_initial_taxonomies() { function create_initial_taxonomies() {
global $wp_rewrite;
register_taxonomy( 'category', 'post', array( register_taxonomy( 'category', 'post', array(
'hierarchical' => true, 'hierarchical' => true,
'update_count_callback' => '_update_post_term_count', 'update_count_callback' => '_update_post_term_count',
@ -22,7 +24,7 @@ function create_initial_taxonomies() {
'rewrite' => did_action( 'init' ) ? array( 'rewrite' => did_action( 'init' ) ? array(
'hierarchical' => true, 'hierarchical' => true,
'slug' => get_option('category_base') ? get_option('category_base') : 'category', '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, 'public' => true,
'show_ui' => true, 'show_ui' => true,
'_builtin' => true, '_builtin' => true,
@ -34,7 +36,7 @@ function create_initial_taxonomies() {
'query_var' => 'tag', 'query_var' => 'tag',
'rewrite' => did_action( 'init' ) ? array( 'rewrite' => did_action( 'init' ) ? array(
'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', '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, 'public' => true,
'show_ui' => true, 'show_ui' => true,
'_builtin' => true, '_builtin' => true,
@ -329,7 +331,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
$tag = '([^/]+)'; $tag = '([^/]+)';
$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term="); $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']) ) if ( is_null($args['show_ui']) )

View File

@ -29,7 +29,7 @@ $wp_version = '3.1.1-alpha-17490';
* *
* @global int $wp_db_version * @global int $wp_db_version
*/ */
$wp_db_version = 17056; $wp_db_version = 17510;
/** /**
* Holds the TinyMCE version * Holds the TinyMCE version