Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#7216 closed enhancement (fixed)

remove_filter should allow all callback functions for a tag to be removed

Reported by: filosofo's profile filosofo Owned by: jacobsantos's profile jacobsantos
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6
Component: General Keywords: has-patch remove_filter dev-feedback
Focuses: Cc:


Sometimes you want to remove lambda callback functions, and sometimes you want to remove all callback functions for a given action or filter hook, but currently you can't.

My patch allows you to remove all callback functions for a given tag, by specifying "all" as the function name: remove_filter('tag_name', 'all');

Attachments (2)

remove_filter.diff (720 bytes) - added by filosofo 16 years ago.
7216.r8534.diff (1.4 KB) - added by santosj 16 years ago.
remove_all_filters() and remove_all_actions() based off of r8534

Download all attachments as: .zip

Change History (11)

#1 @jacobsantos
16 years ago

Suggestion: Create a new function for handling this behavior.

#2 @jacobsantos
16 years ago

  • Owner changed from anonymous to jacobsantos

#3 @jacobsantos
16 years ago

  • Status changed from new to assigned

#4 @filosofo
16 years ago

Why a new function? apply_filters lets you pass "all" as the "tag," so this is parallel behavior. Performance reasons should not be a factor, because remove_filter is not called enough to make a difference, and the check on that block should be pretty quick anyways.

Another function is just something else to have to remember.

#5 @jacobsantos
16 years ago

Branches are something to be avoided as much as possible. The CPU still has to decide: Well, do I go into the branch and start loading that code or should I skip it and load the code after.

Having its own separate function, would be a short body and be pretty sweet.

16 years ago

remove_all_filters() and remove_all_actions() based off of r8534

#6 @santosj
16 years ago

  • Keywords all removed

#7 @santosj
16 years ago

  • Keywords dev-feedback added
  • Milestone changed from 2.9 to 2.7

Can this get in to 2.7?

#8 @santosj
16 years ago

Is the patch acceptable for 2.7?

#9 @westi
16 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [8660]) remove_all_{actions|filters}. Fixes #7216 props filosofo and santosj.

Note: See TracTickets for help on using tickets.