[wp-trac] [WordPress Trac] #20998: the_content filter hooks are not called when $priority is greater than 11.

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 17 14:22:29 UTC 2012


#20998: the_content filter hooks are not called when $priority is greater than 11.
--------------------------+-----------------------------
 Reporter:  attosoft      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.4
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 the_content filter hooks in custom shortcode are not called when $priority
 of add_filter() is greater than 11.

 I defined the following test shortcode and filter in functions.php.

 {{{
 function test_shortcode() {
         return apply_filters('the_content', '<p>test_shortcode</p>');
 }
 add_shortcode('test', 'test_shortcode');

 function test_filter($text) {
         var_dump(htmlspecialchars($text));
         return $text;
 }
 add_filter('the_content', 'test_filter', $priority);
 }}}

 Then I created the post below and viewed it.

 {{{
 <p>test page</p>
 [test]
 }}}

 var_dump() outputs as follows if "`$priority <= 11`".

 {{{
 string(34) "<p>test_shortcode</p> " string(64) "<p>test page</p>
 <p>test_shortcode</p> "
 }}}

 And var_dump() outputs as follows if "`$priority > 11`".

 {{{
 string(34) "<p>test_shortcode</p> "
 }}}

 This shows test_filter() is called from apply_filters() in
 test_shortcode(), but not called from apply_filters() in the_content() in
 wp-includes/post-template.php.

 I guess there is a problem in add_filter() or apply_filter() in wp-
 includes/plugin.php.

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


More information about the wp-trac mailing list