can I do something like that? to pass arguments to my function? I already studied add_action doc but did not figure out how to do it. What the exact syntax to pass two argum
Basically the do_action
is placed where the action should be executed, and it needs a name plus your custom parameters.
When you come to call the function using add_action, pass the name of your do_action()
as your first argument, and the function name as the second. So something like:
function recent_post_by_author($author,$number_of_posts) {
some commands;
}
add_action('get_the_data','recent_post_by_author',10,'author,2');
This is where it's executed
do_action('get_the_data',$author,$number_of_posts);
Should hopefully work.