Return false from metadata_exists() if the get_$type_metadata filter returns a false value.

props xknown.
fixes #22746.


git-svn-id: https://develop.svn.wordpress.org/trunk@27562 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2014-03-17 19:39:31 +00:00
parent adf2b46b8e
commit 681ca37c63
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -83,6 +83,17 @@ class Tests_Meta extends WP_UnitTestCase {
$this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
}
/**
* @ticket 22746
*/
function test_metadata_exists_with_filter() {
// Let's see if it returns the correct value when adding a filter.
add_filter( 'get_user_metadata', '__return_zero' );
$this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // existing meta key
$this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
remove_filter( 'get_user_metadata', '__return_zero' );
}
/**
* @ticket 18158
*/