Changeset 17244
- Timestamp:
- 01/09/2011 04:19:48 PM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r17243 r17244 1693 1693 1694 1694 if ( !empty($q['category__in']) ) { 1695 $q['category__in'] = array_ unique( $q['category__in']);1695 $q['category__in'] = array_map('absint', array_unique( $q['category__in'] ) ); 1696 1696 $tax_query[] = array( 1697 1697 'taxonomy' => 'category', … … 1702 1702 1703 1703 if ( !empty($q['category__not_in']) ) { 1704 $q['category__not_in'] = array_ unique( $q['category__not_in']);1704 $q['category__not_in'] = array_map('absint', array_unique( $q['category__not_in'] ) ); 1705 1705 $tax_query[] = array( 1706 1706 'taxonomy' => 'category', 1707 1707 'terms' => $q['category__not_in'], 1708 'operator' => 'NOT IN', 1708 'operator' => 'NOT IN' 1709 ); 1710 } 1711 1712 if ( !empty($q['category__and']) ) { 1713 $q['category__and'] = array_map('absint', array_unique( $q['category__and'] ) ); 1714 $tax_query[] = array( 1715 'taxonomy' => 'category', 1716 'terms' => $q['category__and'], 1717 'field' => 'term_id', 1718 'operator' => 'AND' 1709 1719 ); 1710 1720 } … … 1712 1722 // Tag stuff 1713 1723 if ( !empty($q['tag_id']) ) { 1724 $q['tag_id'] = absint( $q['tag_id'] ); 1714 1725 $tax_query[] = array( 1715 1726 'taxonomy' => 'post_tag', 1716 'terms' => $q['tag_id'] ,1727 'terms' => $q['tag_id'] 1717 1728 ); 1718 1729 } 1719 1730 1720 1731 if ( !empty($q['tag__in']) ) { 1732 $q['tag__in'] = array_map('absint', array_unique( $q['tag__in'] ) ); 1721 1733 $tax_query[] = array( 1722 1734 'taxonomy' => 'post_tag', 1723 'terms' => $q['tag__in'] ,1735 'terms' => $q['tag__in'] 1724 1736 ); 1725 1737 } 1726 1738 1727 1739 if ( !empty($q['tag__not_in']) ) { 1740 $q['tag__not_in'] = array_map('absint', array_unique( $q['tag__not_in'] ) ); 1728 1741 $tax_query[] = array( 1729 1742 'taxonomy' => 'post_tag', 1730 1743 'terms' => $q['tag__not_in'], 1731 'operator' => 'NOT IN', 1744 'operator' => 'NOT IN' 1745 ); 1746 } 1747 1748 if ( !empty($q['tag__and']) ) { 1749 $q['tag__and'] = array_map('absint', array_unique( $q['tag__and'] ) ); 1750 $tax_query[] = array( 1751 'taxonomy' => 'post_tag', 1752 'terms' => $q['tag__and'], 1753 'operator' => 'AND' 1754 ); 1755 } 1756 1757 if ( !empty($q['tag_slug__in']) ) { 1758 $q['tag_slug__in'] = array_map('sanitize_title', $q['tag_slug__in']); 1759 $tax_query[] = array( 1760 'taxonomy' => 'post_tag', 1761 'terms' => $q['tag_slug__in'], 1762 'field' => 'slug' 1763 ); 1764 } 1765 1766 if ( !empty($q['tag_slug__and']) ) { 1767 $q['tag_slug__and'] = array_map('sanitize_title', $q['tag_slug__and']); 1768 $tax_query[] = array( 1769 'taxonomy' => 'post_tag', 1770 'terms' => $q['tag_slug__and'], 1771 'field' => 'slug', 1772 'operator' => 'AND' 1732 1773 ); 1733 1774 } -
trunk/wp-includes/taxonomy.php
r17240 r17244 672 672 673 673 $where[] = "$alias.term_taxonomy_id $operator ($terms)"; 674 } 675 elseif ( 'NOT IN' == $operator ) { 674 } elseif ( 'NOT IN' == $operator ) { 676 675 677 676 if ( empty( $terms ) ) … … 684 683 FROM $wpdb->term_relationships 685 684 WHERE term_taxonomy_id IN ($terms) 685 )"; 686 } elseif ( 'AND' == $operator ) { 687 688 if ( empty( $terms ) ) 689 continue; 690 691 $num_terms = count( $terms ); 692 693 $terms = implode( ',', $terms ); 694 695 $where[] = "$primary_table.$primary_id_column IN ( 696 SELECT object_id 697 FROM $wpdb->term_relationships 698 WHERE term_taxonomy_id IN ($terms) 699 GROUP BY object_id HAVING COUNT(object_id) = $num_terms 686 700 )"; 687 701 }
Note: See TracChangeset
for help on using the changeset viewer.