4

given this:

<?php add_action( $hook, $function_to_add, $priority, $accepted_args ); ?>

Is there a way to get $hook value inside the function $function_to_add?

7

The name of the current hook is always current_filter(). Despite its name, this function returns the name of actions too.

Usage example: Move the textarea in a comment form.

The current priority is: key( $GLOBALS['wp_filter'][ $hook ] ).

  • 3
    @Reigel ... and then there's the current_action wrapper for those who find it strange to use current_filter in action callbacks ;-) – birgire Apr 29 '15 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.