Ticket #12533: 12533.diff
File 12533.diff, 1.4 KB (added by , 15 years ago) |
---|
-
query.php
1965 1965 if ( '' != $q['taxonomy'] ) { 1966 1966 $taxonomy = $q['taxonomy']; 1967 1967 $tt[$taxonomy] = $q['term']; 1968 $terms = get_terms($q['taxonomy'], array('slug' =>$q['term']));1968 $terms = get_terms($q['taxonomy'], array('slug' => $q['term'], 'hide_empty' => false)); 1969 1969 } else { 1970 1970 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 1971 1971 if ( $t->query_var && '' != $q[$t->query_var] ) { 1972 $terms = get_terms($taxonomy, array('slug' =>$q[$t->query_var]));1972 $terms = get_terms($taxonomy, array('slug' => $q[$t->query_var])); 1973 1973 if ( !is_wp_error($terms) ) 1974 1974 break; 1975 1975 } 1976 1976 } 1977 1977 } 1978 if ( is_wp_error($terms) || empty($terms)) {1978 if ( is_wp_error($terms) ) { 1979 1979 $whichcat = " AND 0 "; 1980 1980 } else { 1981 foreach ( $terms as $term ) 1981 foreach ( $terms as $term ) { 1982 1982 $term_ids[] = $term->term_id; 1983 if ( is_taxonomy_hierarchical($taxonomy) ) { 1984 $children = get_term_children($term->term_id, $taxonomy); 1985 if ( is_wp_error($children) ) 1986 continue; 1987 $term_ids = array_merge($term_ids, $children); 1988 } 1989 } 1983 1990 $post_ids = get_objects_in_term($term_ids, $taxonomy); 1984 1991 if ( !is_wp_error($post_ids) && count($post_ids) ) { 1985 1992 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";