Using arguments with add_action and do_action
-
From what I read to add arguments to a function specified in add_action I need to do the following:
add_action(‘wp_head’,’vclAddtoHead’,10,2);
do_action(‘wp_head’,’somescripts’, ‘somemorescripts’);function vclAddtoHead($arg1,$arg2){
echo $arg1;
echo $arg2;
}So this should specify that I want to add two arguments to vclAddtoHead() and that these two arguments which are specified here as ‘somescripts’ and ‘somemorescripts’ should be printed in the head tags when the page is built.
However I keep getting the following error: Warning: Missing argument 2 for vclAddtoHead()
Also the header section seems to be being written twice, both times incorrectly. Where am I going wrong?
- The topic ‘Using arguments with add_action and do_action’ is closed to new replies.