WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/wp-includes/taxonomy.php

    r17444 r17527  
    1616 */
    1717function create_initial_taxonomies() {
     18    global $wp_rewrite;
     19
    1820    register_taxonomy( 'category', 'post', array(
    1921        'hierarchical' => true,
     
    2325                    'hierarchical' => true,
    2426                    'slug' => get_option('category_base') ? get_option('category_base') : 'category',
    25                     'with_front' => false) : false,
     27                    'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false,
    2628        'public' => true,
    2729        'show_ui' => true,
     
    3537        'rewrite' => did_action( 'init' ) ? array(
    3638                    'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
    37                     'with_front' => false) : false,
     39                    'with_front' => ( get_option('category_base') && ! $wp_rewrite->using_index_permalinks() ) ? false : true ) : false,
    3840        'public' => true,
    3941        'show_ui' => true,
     
    330332
    331333        $wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
    332         $wp_rewrite->add_permastruct($taxonomy, "{$wp_rewrite->root}{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
     334        $wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
    333335    }
    334336
     
    888890        $field = 't.name';
    889891    } else {
    890         return get_term( (int) $value, $taxonomy, $output, $filter);
     892        $term = get_term( (int) $value, $taxonomy, $output, $filter);
     893        if ( is_wp_error( $term ) )
     894            $term = false;
     895        return $term;
    891896    }
    892897
     
    28432848
    28442849    if ( empty($termlink) ) {
    2845         if ( $t->query_var )
     2850        if ( 'category' == $taxonomy )
     2851            $termlink = '?cat=' . $term->term_id;
     2852        elseif ( $t->query_var )
    28462853            $termlink = "?$t->query_var=$slug";
    28472854        else
Note: See TracChangeset for help on using the changeset viewer.