diff --git src/wp-includes/plugin.php src/wp-includes/plugin.php
index 27a65ee..ca3c610 100644
|
|
|
function remove_all_filters( $tag, $priority = false ) { |
| 325 | 325 | global $wp_filter, $merged_filters; |
| 326 | 326 | |
| 327 | 327 | if ( isset( $wp_filter[ $tag ]) ) { |
| 328 | | if ( false !== $priority && isset( $wp_filter[ $tag ][ $priority ] ) ) { |
| 329 | | $wp_filter[ $tag ][ $priority ] = array(); |
| | 328 | if ( false !== $priority ) { |
| | 329 | if ( isset( $wp_filter[ $tag ][ $priority ] ) ) { |
| | 330 | $wp_filter[ $tag ][ $priority ] = array(); |
| | 331 | } |
| 330 | 332 | } else { |
| 331 | 333 | $wp_filter[ $tag ] = array(); |
| 332 | 334 | } |
diff --git tests/phpunit/tests/filters.php tests/phpunit/tests/filters.php
index c0eb125..11a99f1 100644
|
|
|
class Tests_Filters extends WP_UnitTestCase { |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| | 254 | * @ticket 20920 |
| | 255 | */ |
| | 256 | function test_has_filter_after_remove_filters_on_unused_priority() { |
| | 257 | $a = new MockAction(); |
| | 258 | $tag = rand_str(); |
| | 259 | $val = rand_str(); |
| | 260 | |
| | 261 | // Should not be removed |
| | 262 | add_filter( $tag, array( $a, 'filter' ), 12 ); |
| | 263 | $this->assertTrue( has_filter( $tag ) ); |
| | 264 | |
| | 265 | remove_all_filters( $tag, 11 ); |
| | 266 | $this->assertTrue( has_filter( $tag ) ); |
| | 267 | } |
| | 268 | |
| | 269 | /** |
| 254 | 270 | * @ticket 29070 |
| 255 | 271 | */ |
| 256 | 272 | function test_has_filter_after_remove_all_filters() { |