There’s a function attached to a set of actions, like this:
add_action('some_tag', 'the_function');
function the_function($maybe_some_vars){
// ...
}
Is it possible to find out the action name (“some_tag”) within the_function?
The reason I’m asking, is that I’m attaching the function to multiple actions (some of them custom, some belong to WP like the_content
). The code that executes within the function depends on knowing the name of the action.
I did manage to get it using debug_backtrace()
, but I’m pretty sure that’s not a very reliable way.
Simple:
current_filter();
(link to plugin.php) orglobal $wp_current_filter;
.