How to add arguments into an add_action() call?
-
I have a php function that needs to take in 5-6 arguments from a shortcode. Those arguments are for adding php variables into a javascript code. I want that javascript code to be added to just before the body tag ends. So to do this I need to add an action to wp_footer.
add_action('wp_footer', 'example_function', $var1, $var2, $var3, $var4, $var5);
This code does not really work, I have that in my shortcode function. The shortcode itself works perfect!
The codex says:
<?php add_action( $tag, $function_to_add, $priority, $accepted_args ); ?>
So it can accept arguments, but I have just seen examples with 1 argument and not several which is needed in my case. Anyone know how I can achieve this?
- The topic ‘How to add arguments into an add_action() call?’ is closed to new replies.