Skip to content

Instantly share code, notes, and snippets.

@gicolek
Last active September 2, 2017 16:27
Show Gist options
  • Select an option

  • Save gicolek/212d1b49cc7fdb684807 to your computer and use it in GitHub Desktop.

Select an option

Save gicolek/212d1b49cc7fdb684807 to your computer and use it in GitHub Desktop.
Do Action explained
<?php
// this can be placed anywhere in the plugin (before storing the form values in the database)
// $form_data could be an array of data which was created by the user
do_action('my_action_after_save', $form_data);
// we're telling wordpress to execute the code added in the second parameter method right where do_action has been specified
add_action('my_action_after_save', 'my_action_after_save_hook', 10);
/**
* Use the form data and send it over to mailchimp
* @hook my_action_after_save
*/
function my_action_after_save_hook($form_data){
// write a code to collect the user submitted values and send it over to mailchimp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment