Opened 11 months ago
Last modified 11 months ago
#20920 new defect (bug)
Removing all hooks too aggressive if a priority number is given
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Plugins | Version: | 3.3.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
When you call remove_all_filters() or remove_all_actions() with a priority number (second parameter), all hooks get removed if none is found with the given priority.
Example:
<?php global $wp_filter; add_action('my_action', 'callback_foo'); add_action('my_action', 'callback_bar', 20); var_dump($wp_filter['my_action']); // At this point only callback_foo is left. Fine. remove_all_actions('my_action', 20); var_dump($wp_filter['my_action']); // Exactly the same function call as above, // but now all hooks bound to my_action are removed! remove_all_actions('my_action', 20); var_dump($wp_filter['my_action']);
Calling remove_all_filters() or remove_all_actions() with a priority should never remove hooks with another priority.
Attachments (1)
Change History (2)
comment:1
SergeyBiryukov — 11 months ago
- Component changed from General to Plugins
- Milestone changed from Awaiting Review to Future Release
Note: See
TracTickets for help on using
tickets.
