You appear to be a bot. Output may be restricted
Description
Usage
Tests_Actions::test_remove_anonymous_callback();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/actions.php
Lines:
1 to 27 of 27
public function test_remove_anonymous_callback() { $tag = __FUNCTION__; $a = new MockAction(); add_action( $tag, array( $a, 'action' ), 12, 1 ); $this->assertTrue( has_action( $tag ) ); $hook = $GLOBALS['wp_filter'][ $tag ]; // From http://wordpress.stackexchange.com/a/57088/6445 foreach ( $hook as $priority => $filter ) { foreach ( $filter as $identifier => $function ) { if ( is_array( $function ) && is_a( $function['function'][0], 'MockAction' ) && 'action' === $function['function'][1] ) { remove_filter( $tag, array( $function['function'][0], 'action' ), $priority ); } } } $this->assertFalse( has_action( $tag ) ); }