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

git-svn-id: https://develop.svn.wordpress.org/trunk@5660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-06-06 16:13:12 +00:00
parent 4feb85438d
commit e1ef29586c
2 changed files with 6 additions and 8 deletions

View File

@@ -915,15 +915,13 @@ class WP_Query {
$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) ";
$whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
$whichcat .= "AND $wpdb->term_taxonomy.term_id IN ({$q['cat']}, ";
$whichcat .= get_category_children($q['cat'], '', ', ');
$whichcat = substr($whichcat, 0, -2);
$whichcat .= ")";
$in_cats = array($q['cat']);
$in_cats = array_merge($in_cats, get_term_children($q['cat'], 'category'));
$in_cats = "'" . implode("', '", $in_cats) . "'";
$whichcat .= "AND $wpdb->term_taxonomy.term_id IN ($in_cats)";
$groupby = "{$wpdb->posts}.ID";
}
// Author/user stuff
if ( empty($q['author']) || ($q['author'] == '0') ) {