Ensure that terms with a post count of 0 are not returned in wp_count_terms() when hide_empty => true. Adds unit test which ensures that wp_count_terms() returns 0.

Props markjaquith.
Fixes #15919.


Built from https://develop.svn.wordpress.org/trunk@25551


git-svn-id: http://core.svn.wordpress.org/trunk@25471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-09-21 16:48:10 +00:00
parent c2312dfe4c
commit 2d323d43e1

View File

@ -1369,6 +1369,9 @@ function get_terms($taxonomies, $args = '') {
$where .= " AND tt.parent = '$parent'";
}
if ( 'count' == $fields )
$hierarchical = false;
if ( $hide_empty && !$hierarchical )
$where .= ' AND tt.count > 0';