[wp-trac] [WordPress Trac] #16245: remove_filter makes filters applied after that useless

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 15 18:59:36 UTC 2011


#16245: remove_filter makes filters applied after that useless
--------------------------+-----------------------------
 Reporter:  oddoneout     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.0.4
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Here's some codes:

 {{{
 function run_once() {
 remove_filter( 'foobar', 'run_once' );
 return 'test';
 }
 add_filter( 'foobar', 'run_once' );

 add_filter( 'foobar', function($test) {return 'test again';}, 11 );

 echo apply_filters( 'foobar', '', 'huh' );
 }}}

 The result of this is 'test' instead of 'test again'. This might happen
 with remove_action, I haven't tested that function though.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16245>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list