Changeset 31275 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 01/24/2015 06:47:30 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r31270 r31275 1548 1548 * 1549 1549 * @since 2.3.0 1550 * @since 4.2.0 Introduced 'name' parameter.1550 * @since 4.2.0 Introduced 'name' and 'childless' parameters. 1551 1551 * 1552 1552 * @global wpdb $wpdb WordPress database abstraction object. … … 1596 1596 * are passed, $child_of is ignored. Default 0. 1597 1597 * @type int|string $parent Parent term ID to retrieve direct-child terms of. Default empty. 1598 * @type bool $childless True to limit results to terms that have no children. This parameter has 1599 * no effect on non-hierarchical taxonomies. Default false. 1598 1600 * @type string $cache_domain Unique cache key to be produced when this query is stored in an 1599 1601 * object cache. Default is 'core'. … … 1620 1622 $defaults = array('orderby' => 'name', 'order' => 'ASC', 1621 1623 'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), 1622 'number' => '', 'fields' => 'all', 'name' => '', 'slug' => '', 'parent' => '', 1624 'number' => '', 'fields' => 'all', 'name' => '', 'slug' => '', 'parent' => '', 'childless' => false, 1623 1625 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'description__like' => '', 1624 1626 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' ); … … 1639 1641 1640 1642 if ( 'all' == $args['get'] ) { 1643 $args['childless'] = false; 1641 1644 $args['child_of'] = 0; 1642 1645 $args['hide_empty'] = 0; … … 1755 1758 } 1756 1759 1760 $exclusions = array(); 1757 1761 if ( ! empty( $exclude_tree ) ) { 1758 1762 $exclude_tree = wp_parse_id_list( $exclude_tree ); … … 1764 1768 ); 1765 1769 } 1766 $exclusions = implode( ',', array_map( 'intval', $excluded_children ) ); 1767 } else { 1768 $exclusions = ''; 1770 $exclusions = array_merge( $excluded_children, $exclusions ); 1769 1771 } 1770 1772 1771 1773 if ( ! empty( $exclude ) ) { 1772 $exterms = wp_parse_id_list( $exclude ); 1773 if ( empty( $exclusions ) ) { 1774 $exclusions = implode( ',', $exterms ); 1775 } else { 1776 $exclusions .= ', ' . implode( ',', $exterms ); 1774 $exclusions = array_merge( wp_parse_id_list( $exclude ), $exclusions ); 1775 } 1776 1777 // 'childless' terms are those without an entry in the flattened term hierarchy. 1778 $childless = (bool) $args['childless']; 1779 if ( $childless ) { 1780 foreach ( $taxonomies as $_tax ) { 1781 $term_hierarchy = _get_term_hierarchy( $_tax ); 1782 $exclusions = array_merge( array_keys( $term_hierarchy ), $exclusions ); 1777 1783 } 1778 1784 } 1779 1785 1780 1786 if ( ! empty( $exclusions ) ) { 1781 $exclusions = ' AND t.term_id NOT IN (' . $exclusions. ')';1787 $exclusions = ' AND t.term_id NOT IN (' . implode( ',', array_map( 'intval', $exclusions ) ) . ')'; 1782 1788 } 1783 1789
Note: See TracChangeset
for help on using the changeset viewer.