[wp-trac] Re: [WordPress Trac] #5015: Add_Filter priority fails with some hooks

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 19 21:04:23 GMT 2007


#5015: Add_Filter priority fails with some hooks
-------------------------------+--------------------------------------------
 Reporter:  mattyrob           |        Owner:  anonymous 
     Type:  defect             |       Status:  closed    
 Priority:  high               |    Milestone:  2.3       
Component:  General            |      Version:  2.3       
 Severity:  normal             |   Resolution:  worksforme
 Keywords:  plugin add_filter  |  
-------------------------------+--------------------------------------------
Changes (by markjaquith):

  * status:  new => closed
  * resolution:  => worksforme

Comment:

 Cannot reproduce.  Here was my test code:

 {{{
 <?php
 require_once('wp-config.php');

 class FooBar {
         function FooBar() {
                 add_filter('myfilter', array(&$this, 'method_do'), 1);
         }

         function method_do($input) {
                 return $input . " method_do() called,";
         }
 }

 function function_do($input) {
         return $input ." function_do() called.";
 }

 add_filter('myfilter', 'function_do', 10);
 $foobar = new FooBar; // adds with priority 1

 $output = apply_filters('myfilter', 'Filter started,');

 echo $output;

 ?>
 }}}

 Output was:

 {{{
 Filter started, method_do() called, function_do() called.
 }}}

 ... as expected.

 Try doing a {{{die('Worked')}}} or a {{{mail('you at example.com',
 'the_content', 'Worked');}}} in your method.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5015#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list