Use get_term_children() and get_term_field(). see #4189
git-svn-id: http://svn.automattic.com/wordpress/trunk@5660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d2188a7dde
commit
a09031ecd0
|
@ -172,8 +172,8 @@ function category_description($category = 0) {
|
|||
global $cat;
|
||||
if ( !$category )
|
||||
$category = $cat;
|
||||
$category = & get_category($category);
|
||||
return apply_filters('category_description', $category->description, $category->term_id);
|
||||
|
||||
return get_term_field('description', $category, 'category');
|
||||
}
|
||||
|
||||
function wp_dropdown_categories($args = '') {
|
||||
|
|
|
@ -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') ) {
|
||||
|
|
Loading…
Reference in New Issue