WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using this code to plant a script on a spesific page, it works but inserts the script into the bottom of the page not the top - I'm at a loss to explain why! Is there a way to do this that results in the script being inserted inside the head tags.

function single_page_load() {
    if ( !is_page_template( 'interactive-map.php' ) )
        wp_enqueue_script( 'map', get_template_directory_uri() . 'jquery-map/map.js', array('jquery'), '1.4.2', true );
add_action( 'template_redirect', 'single_page_load' );
share|improve this question
up vote 2 down vote accepted

wp_enqueue_script accepts 5 parameters. The fifth one is $in_footer. If that parameter is set to true the script will load in the footer.

If it is set to false it will load in the head, unless a dependency (like jQuery in your code) is set to show up in the footer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.