Fix registration of default taxonomies so that proper rewrite rules are written.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
11cbf4e3d7
commit
30ee53dd96
|
@ -253,7 +253,7 @@ class WP {
|
|||
$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
|
||||
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
|
||||
if ( isset($t->query_var) )
|
||||
if ( $t->query_var )
|
||||
$taxonomy_query_vars[$t->query_var] = $taxonomy;
|
||||
|
||||
for ($i=0; $i<count($this->public_query_vars); $i += 1) {
|
||||
|
|
|
@ -1399,7 +1399,7 @@ class WP_Query {
|
|||
if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
|
||||
$this->is_tax = false;
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
|
||||
if ( isset($t->query_var) && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
|
||||
if ( $t->query_var && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
|
||||
$qv['taxonomy'] = $taxonomy;
|
||||
$qv['term'] = $qv[$t->query_var];
|
||||
$this->is_tax = true;
|
||||
|
@ -1938,7 +1938,7 @@ class WP_Query {
|
|||
$terms = get_terms($q['taxonomy'], array('slug'=>$q['term']));
|
||||
} else {
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
|
||||
if ( isset($t->query_var) && '' != $q[$t->query_var] ) {
|
||||
if ( $t->query_var && '' != $q[$t->query_var] ) {
|
||||
$terms = get_terms($taxonomy, array('slug'=>$q[$t->query_var]));
|
||||
if ( !is_wp_error($terms) )
|
||||
break;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
* Creates the initial taxonomies when 'init' action is fired.
|
||||
*/
|
||||
function create_initial_taxonomies() {
|
||||
register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories')) ) ;
|
||||
register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags')) ) ;
|
||||
register_taxonomy( 'link_category', 'link', array('hierarchical' => false) ) ;
|
||||
register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
|
||||
register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'), 'query_var' => false, 'rewrite' => false) ) ;
|
||||
register_taxonomy( 'link_category', 'link', array('hierarchical' => false, 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
|
||||
}
|
||||
add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
|
||||
|
||||
|
|
Loading…
Reference in New Issue