mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
In remove_all_filters(), only remove callbacks that match the $priority parameter.
Props GeertDD, valendesigns. Fixes #20920. git-svn-id: https://develop.svn.wordpress.org/trunk@31014 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -196,6 +196,25 @@ class Tests_Filters extends WP_UnitTestCase {
|
||||
$this->assertEquals(array($tag), $a->get_tags());
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 20920
|
||||
*/
|
||||
function test_remove_all_filters_should_respect_the_priority_argument() {
|
||||
$a = new MockAction();
|
||||
$tag = rand_str();
|
||||
$val = rand_str();
|
||||
|
||||
add_filter( $tag, array( $a, 'filter' ), 12 );
|
||||
$this->assertTrue( has_filter( $tag ) );
|
||||
|
||||
// Should not be removed.
|
||||
remove_all_filters( $tag, 11 );
|
||||
$this->assertTrue( has_filter( $tag ) );
|
||||
|
||||
remove_all_filters( $tag, 12 );
|
||||
$this->assertFalse( has_filter( $tag ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 9886
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user