解决方案是在do_action
然后在你的add_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 ){
echo "This function is called by action: " . $called_action_hook ;
}
do_action(\'my_test_hook_1\',\'my_test_hook_1\');
do_action(\'my_test_hook_2\',\'my_test_hook_2\');
etc.