Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 months ago

#41 closed defect (bug) (fixed)

apply_filters()/remove_filter() Bug

Reported by: Agent Orange Owned by: ryan
Milestone: Priority: normal
Severity: major Version:
Component: General Keywords:
Focuses: Cc:


I didn't like my comments to be altered by the wpautop-filter. To disable it I put a remove_filter('comment_text','wpautop') into my wp-comments.php. Now, that didn't work because Wordpress sorts the filters into different priorities in a very strange way. Because of this you need to tell remove_filter() in which priority it has to remove the filter. So the correct code for removing wpautop is remove_filter('comment_text', 'wpautop', 30).

Here's the bug: In priority class 30 theres only wpautop but if you remove it, the priority class stays in the array, pointing to null. When apply_filters() is called, it looks for the array of priorities for a certain text-identifier and executes a foreach($functions as $function). If the priority class is empty, $functions is a null-pointer here, and foreach outputs an error and halts the execution of the script.

See the original and corrected code in the attached file

Attachments (1)

0000041-apply_filters.html (1.9 KB) - added by Agent Orange 11 years ago.

Download all attachments as: .zip

Change History (6)

#2 @ryan
11 years ago

  • Owner changed from anonymous to rboren
  • Resolution changed from 10 to 20
  • Status changed from new to closed

This ticket was mentioned in Slack in #forums by ipstenu. View the logs.

11 months ago

This ticket was mentioned in Slack in #forums by ipstenu. View the logs.

11 months ago

Note: See TracTickets for help on using tickets.