Make WordPress Core


Ignore:
Timestamp:
06/06/2007 04:13:12 PM (19 years ago)
Author:
ryan
Message:

Use get_term_children() and get_term_field(). see #4189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r5609 r5660  
    916916                        $join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
    917917                        $whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
    918                         $whichcat .= "AND $wpdb->term_taxonomy.term_id IN ({$q['cat']}, ";
    919                         $whichcat .= get_category_children($q['cat'], '', ', ');
    920                         $whichcat = substr($whichcat, 0, -2);
    921                         $whichcat .= ")";
     918                        $in_cats = array($q['cat']);
     919                        $in_cats = array_merge($in_cats, get_term_children($q['cat'], 'category'));
     920                        $in_cats = "'" . implode("', '", $in_cats) . "'";
     921                        $whichcat .= "AND $wpdb->term_taxonomy.term_id IN ($in_cats)";
    922922                        $groupby = "{$wpdb->posts}.ID";
    923923                }
    924 
    925 
    926924
    927925                // Author/user stuff
Note: See TracChangeset for help on using the changeset viewer.