How to use the do_action () with parameter

August 1st, 2020 Shabu James 16 Views 0 Uncategorised33 seconds
do_action('unique_action_tag', $parameter1, $parameter2,,,, & so on);
// 10 is the priority, higher means executed first
// 2 is number of arguments the function can accept
add_action('unique_action_tag', 'my_custom_function', 10, 2)
function my_custom_function($param1, $param2) {
    // do something
}

The correct way is to pass first argument as a unique string which acts as an identifier for the action & any additional arguments after that

About The Author

Shabu James

Leave Your Thoughts Here...
Notice: Undefined variable: comment in /home/letshmvm/public_html/wp-content/themes/shabu-portfolio/functions.php on line 557

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.

Name *
Comment

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.