Changeset 15732
- Timestamp:
- 10/06/2010 11:04:03 AM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r15731 r15732 1487 1487 $tax_query = array(); 1488 1488 1489 if ( $this->is_tax ) { 1490 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 1491 if ( $t->query_var && !empty( $q[$t->query_var] ) ) { 1492 $tax_query_defaults = array( 1493 'taxonomy' => $taxonomy, 1494 'field' => 'slug', 1495 'operator' => 'IN' 1496 ); 1497 1498 $term = str_replace( ' ', '+', $q[$t->query_var] ); 1499 1500 if ( strpos($term, '+') !== false ) { 1501 $terms = preg_split( '/[+\s]+/', $term ); 1502 foreach ( $terms as $term ) { 1503 $tax_query[] = array_merge( $tax_query_defaults, array( 1504 'terms' => array( $term ) 1505 ) ); 1506 } 1507 } else { 1489 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 1490 if ( $t->query_var && !empty( $q[$t->query_var] ) ) { 1491 $tax_query_defaults = array( 1492 'taxonomy' => $taxonomy, 1493 'field' => 'slug', 1494 'operator' => 'IN' 1495 ); 1496 1497 $term = urlencode( urldecode( $q[$t->query_var] ) ); 1498 1499 if ( $t->hierarchical_url ) { 1500 $tax_query[] = array_merge( $tax_query_defaults, array( 1501 'terms' => array( basename( str_replace( '%2F', '/', $term ) ) ) 1502 ) ); 1503 } elseif ( strpos($term, '+') !== false ) { 1504 $terms = preg_split( '/[+\s]+/', $term ); 1505 foreach ( $terms as $term ) { 1508 1506 $tax_query[] = array_merge( $tax_query_defaults, array( 1509 'terms' => preg_split('/[,\s]+/', $term)1507 'terms' => array( $term ) 1510 1508 ) ); 1511 1509 } 1510 } else { 1511 $tax_query[] = array_merge( $tax_query_defaults, array( 1512 'terms' => preg_split('/[,\s]+/', $term) 1513 ) ); 1512 1514 } 1513 1515 } … … 1550 1552 'operator' => 'NOT IN', 1551 1553 'field' => 'term_id' 1552 );1553 }1554 1555 // Category stuff for nice URLs1556 if ( '' != $q['category_name'] && !$this->is_singular ) {1557 $q['category_name'] = str_replace( '%2F', '/', urlencode(urldecode($q['category_name'])) );1558 $q['category_name'] = '/' . trim( $q['category_name'], '/' );1559 1560 $tax_query[] = array(1561 'taxonomy' => 'category',1562 'terms' => array( basename( $q['category_name'] ) ),1563 'operator' => 'IN',1564 'field' => 'slug'1565 1554 ); 1566 1555 } -
trunk/wp-includes/taxonomy.php
r15731 r15732 18 18 register_taxonomy( 'category', 'post', array( 19 19 'hierarchical' => true, 20 'hierarchical_url' => true, 20 21 'update_count_callback' => '_update_post_term_count', 21 'query_var' => false,22 'query_var' => 'category_name', 22 23 'rewrite' => false, 23 24 'public' => true,
Note: See TracChangeset
for help on using the changeset viewer.