WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2014 10:04:11 PM (5 years ago)
Author:
boonebgorges
Message:

In get_terms(), select term taxonomy count for all values of 'fields'.

Not having the count caused queries with 'fields' values of 'id=>name' and
'id=>slug' to return incorrect results when querying a hierarchical taxonomy
with 'hide_empty=true'.

Includes unit tests for get_terms() when using various combinations of 'fields',
'hide_empty', and 'hierarchical' arguments.

Props technical_mastermind.
Fixes #29859.

File:
1 edited

Legend:

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

    r29549 r29845  
    15131513            break;
    15141514        case 'id=>name':
    1515             $selects = array( 't.term_id', 't.name' );
     1515            $selects = array( 't.term_id', 't.name', 'tt.count' );
    15161516            break;
    15171517        case 'id=>slug':
    1518             $selects = array( 't.term_id', 't.slug' );
     1518            $selects = array( 't.term_id', 't.slug', 'tt.count' );
    15191519            break;
    15201520    }
Note: See TracChangeset for help on using the changeset viewer.