Fix double slashing on /index.php//taxonomy/term/ links. Props Scribu. Fixes #12508. Also Fixes #10445

git-svn-id: http://svn.automattic.com/wordpress/trunk@13597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-03-06 03:43:23 +00:00
parent 6abc4ea0fa
commit 2ecc414b32

View File

@ -233,14 +233,12 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
} }
if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) { if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
if ( !is_array($args['rewrite']) ) $args['rewrite'] = wp_parse_args($args['rewrite'], array(
$args['rewrite'] = array(); 'slug' => sanitize_title_with_dashes($taxonomy),
if ( !isset($args['rewrite']['slug']) ) 'with_front' => true,
$args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy); ));
if ( !isset($args['rewrite']['with_front']) ) $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
$args['rewrite']['with_front'] = true; $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
$wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term");
$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']) )