WordPress.org

Make WordPress Core

Ticket #12508: 12508.diff

File 12508.diff, 1.1 KB (added by scribu, 6 years ago)

fix double slashing

  • wp-includes/taxonomy.php

     
    233261        } 
    234262 
    235263        if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) { 
    236                 if ( !is_array($args['rewrite']) ) 
    237                         $args['rewrite'] = array(); 
    238                 if ( !isset($args['rewrite']['slug']) ) 
    239                         $args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy); 
    240                 if ( !isset($args['rewrite']['with_front']) ) 
    241                         $args['rewrite']['with_front'] = true; 
     264                $args['rewrite'] = wp_parse_args($args['rewrite'], array( 
     265                        'slug' => sanitize_title_with_dashes($taxonomy), 
     266                        'with_front' => true, 
     267                )); 
    242268                $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term"); 
    243                 $wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']); 
     269                $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']); 
    244270        } 
    245271 
    246272        if ( is_null($args['show_ui']) )