Make WordPress Core

Changeset 5660


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

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r5616 r5660  
    173173        if ( !$category )
    174174                $category = $cat;
    175         $category = & get_category($category);
    176         return apply_filters('category_description', $category->description, $category->term_id);
     175
     176        return get_term_field('description', $category, 'category');
    177177}
    178178
  • 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.