1

I'm currently working with a Learn Management System and students can earn certificates after they completed a course. This certificate gets generated and has an "action hook" hooked to it, so i can hook in to modify it. My problem is now with the debugging: Every time i want to test my hook i have to create a user and let them complete the course. Has anyone an idea how to trigger the action manually? This would reduce the debugging time drastically. Thank you

  • you can just do do_action("name_of_action"); – mmm Oct 23 '17 at 16:34
2

Use do_action, you can just:

do_action( 'my_action');

if your action has a callback function that need arguments say:

function my_callback( $an_array ){
  //use the array for something here
   var_dump($an_array);
}
add_action( 'my_action', 'my_callback' );

you can specify it in the do_action like this:

do_action( 'my_action', array( 'array_for_callback') );

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.