WordPress.org

Make WordPress Core

Changeset 15824


Ignore:
Timestamp:
10/17/2010 04:36:26 AM (8 years ago)
Author:
dd32
Message:

Move hierarchical_url to $argsrewrite?hierarchical?

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r15819 r15824  
    14601460                $term = $q[$t->query_var];
    14611461
    1462                 if ( $t->hierarchical_url ) {
     1462                if ( $t->rewrite['hierarchical'] ) {
    14631463                    $tax_query[] = array_merge( $tax_query_defaults, array(
    14641464                        'terms' => array( basename( $term ) )
  • trunk/wp-includes/taxonomy.php

    r15818 r15824  
    1818    register_taxonomy( 'category', 'post', array(
    1919        'hierarchical' => true,
    20         'hierarchical_url' => true,
    2120        'update_count_callback' => '_update_post_term_count',
    2221        'query_var' => 'category_name',
     
    287286
    288287    $defaults = array(  'hierarchical' => false,
    289                         'hierarchical_url' => false,
    290288                        'update_count_callback' => '',
    291289                        'rewrite' => true,
     
    308306    }
    309307
    310     if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
     308    if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') && !empty($wp_rewrite) ) {
    311309        $args['rewrite'] = wp_parse_args($args['rewrite'], array(
    312310            'slug' => sanitize_title_with_dashes($taxonomy),
    313311            'with_front' => true,
     312            'hierarchical' => false
    314313        ));
    315         if ( $args['hierarchical'] && $args['hierarchical_url'] )
    316             $wp_rewrite->add_rewrite_tag("%$taxonomy%", '.*?/?([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
     314
     315        if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] )
     316            $tag = '(.*?)';
    317317        else
    318             $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
     318            $tag = '([^/]+)';
     319
     320        $wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
    319321        $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
    320322    }
     
    26212623        $termlink = home_url($termlink);
    26222624    } else {
    2623         if ( $t->hierarchical_url ) {
     2625        if ( $t->rewrite['hierarchical'] ) {
    26242626            $hierarchical_slugs = array();
    26252627            $ancestors = get_ancestors($term->term_id, $taxonomy);
Note: See TracChangeset for help on using the changeset viewer.