WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/21/2009 10:13:44 PM (11 years ago)
Author:
ryan
Message:

get_terms_orderby, get_terms_fields, and tag_clooud-sort filters. Props jhodgdon, filosofo. fixes #9004

File:
1 edited

Legend:

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

    r11013 r11037  
    526526 * The 'list_terms_exclusions' filter passes the compiled exclusions along with
    527527 * the $args.
     528 *
     529 * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
     530 * along with the $args array.
     531
     532 * The 'get_terms_fields' filter passes the fields for the SELECT query
     533 * along with the $args array.
    528534 *
    529535 * The list of arguments that $args can contain, which will overwrite the defaults:
     
    674680    else
    675681        $orderby = 't.term_id';
     682        $orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
    676683
    677684    $where = '';
     
    758765    }
    759766
    760     $select_this = '';
     767    $selects = array();
    761768    if ( 'all' == $fields )
    762         $select_this = 't.*, tt.*';
     769        $selects = array('t.*', 'tt.*');
    763770    else if ( 'ids' == $fields )
    764         $select_this = 't.term_id, tt.parent, tt.count';
     771        $selects = array('t.term_id', 'tt.parent', 'tt.count');
    765772    else if ( 'names' == $fields )
    766         $select_this = 't.term_id, tt.parent, tt.count, t.name';
     773        $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
     774        $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
    767775
    768776    $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
Note: See TracChangeset for help on using the changeset viewer.