How to check if which hook triggered the call to a function?
I found the magic code you need. Use current_filter(). This function will return name of the current filter or action. add_action(‘my_test_hook_1′,’my_test_callback_function’); add_action(‘my_test_hook_2′,’my_test_callback_function’); add_action(‘my_test_hook_3′,’my_test_callback_function’); add_action(‘my_test_hook_4′,’my_test_callback_function’); function my_test_callback_function(){ $called_action_hook = current_filter(); // ***The magic code that will return the last called action echo “This function is called by action: ” . $called_action_hook ; } For reference: https://developer.wordpress.org/reference/functions/current_filter/