Getting the action’s tag name within the action

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?

Read More

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.

Related posts

Leave a Reply

1 comment