Need get_filters() to push-and-pop current filter settings
-
I have a plugin which uses filters to handle what-to-output.
Now I am writing a widget that will call the plugin directly, but would like to override the filters on a per-widget-instance basis. That means I need to “push” or save my plugin’s filters, set them, call the plugin, and “pop”/restore the filter settings.
Unfortunately altho wordpress has a has_filter() to see whether a specific function is hooked to a filter, the user’s theme or other plugins could have set the filters to be anything.
I studied plugin.php and discovered WP has no get_filters() to retrieve the entire current list of functions assigned to a filter. There really should be a get_filters($tag) and a get_actions($tag) which basically return what is currently WP’s internal array.
I would prefer not to hack WP’s internal variables but see no alternative at this point. Any ideas?
- The topic ‘Need get_filters() to push-and-pop current filter settings’ is closed to new replies.