Title: Add Javascript to WordPress header as an array
Last modified: August 19, 2016

---

# Add Javascript to WordPress header as an array

 *  [basilakis](https://wordpress.org/support/users/basilakis/)
 * (@basilakis)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/add-javascript-to-wordpress-header-as-an-array/)
 * Hey,
 * I am trying to figure out how to put a JS array and print it @ wp_head
 * I am doing this
 *     ```
       function weather_process_header() {
       	echo "\n".'<!-- Start Of Script Generated By weather-plugin -->'."\n";
       		wp_register_style('weather-plugin-css', plugins_url('weather-plugin/weather.css'), false, '0.1', 'all');
       		wp_enqueue_script('ajaxcontent', '/wp-content/plugins/weather-plugin/js/ajax-dynamic-content.js', array('weatherplugin'), '2.1');
       		wp_enqueue_script('ajaxweather', '/wp-content/plugins/events-calendar/js/ajax-weather.js', array('weatherplugin'), '1.0b2');
       		wp_print_scripts(array('weather-plugin', 'weatherplugin'));
       		wp_print_styles(array('weather-plugin', 'weather-plugin-css'));
       	echo '<!-- End Of Script Generated By weather-plugin -->'."\n";
       }
       ```
   
 * and then to the wp_head
 *     ```
       add_action('wp_head', 'weather_process_header');
       ```
   
 * But it does not seem to work fine… It prints the CSS but not the JS array. Any
   help? 😀

The topic ‘Add Javascript to WordPress header as an array’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [basilakis](https://wordpress.org/support/users/basilakis/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/add-javascript-to-wordpress-header-as-an-array/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
