Title: adding inline script
Last modified: August 20, 2016

---

# adding inline script

 *  [lerizzle](https://wordpress.org/support/users/lerizzle/)
 * (@lerizzle)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-inline-script/)
 * So I have a plugin that gets a bunch of values that I want to pass to my javascript.
 * I know localize_script will output data but I also want a to write out a function
   call in it.
 * For example my plugin gets a value of “apple”. Once it does I want to place this
   in the footer
 * <script>
    var myVar = ‘apples’; my_function_call(myVar); </script>
 * Well not exactly but you get the idea. I just want to print it out, and not enqueue
   a script file.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [lerizzle](https://wordpress.org/support/users/lerizzle/)
 * (@lerizzle)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-inline-script/#post-2326035)
 * oh and I need to make sure this gets outputted after my other footer scripts 
   which are called enqueue.
 *  Thread Starter [lerizzle](https://wordpress.org/support/users/lerizzle/)
 * (@lerizzle)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-inline-script/#post-2326125)
 * So I was able to do this
 * add_action(‘wp_print_footer_scripts’, ‘add_footer_js’, 10, 1);
 * But now my question is, how do I pass parameters to this function. The only was
   I can see is make them globals so they are available to my function?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘adding inline script’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [lerizzle](https://wordpress.org/support/users/lerizzle/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/adding-inline-script/#post-2326125)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
