mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@25551 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -505,4 +505,11 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
$term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
|
||||
$this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
|
||||
}
|
||||
|
||||
function test_wp_count_terms() {
|
||||
$count = wp_count_terms( 'category', array( 'hide_empty' => true ) );
|
||||
// the terms inserted in setUp aren't attached to any posts, so should return 0
|
||||
// this previously returned 2
|
||||
$this->assertEquals( 0, $count );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user