How to do a remove_action or remove_filter if the add is done via anonymous function?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
18 views
How remove_action or remove_filter if the add is done via anonymous function?

add_filter( 'wp', function() { echo 'test'; }, 345 );


try this option but not working

remove_filter( 'wp', function(){}, 345 );
by | 18 views

1 Answer

0 like 0 dislike
anonymous f-th variable is assigned. the removal of the filter hook point out to her.
add_action( 'the_post', $my_the_post_action = function( $post_object ) { // modify the post object here var_dump($post_object); } ); remove_action('the_post' , $my_the_post_action);
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users