wp_print_head_scripts

The timeline below displays how wordpress function wp_print_head_scripts has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8.0
 *
 * @global WP_Scripts $wp_scripts
 *
 * @return array
 */
function wp_print_head_scripts()
{
    global $wp_scripts;
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    if (!$wp_scripts instanceof WP_Scripts) {
        return array();
        // No need to run if nothing is queued.
    }
    return print_head_scripts();
}

WordPress Version: 5.4

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8.0
 *
 * @global WP_Scripts $wp_scripts
 *
 * @return array
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!$wp_scripts instanceof WP_Scripts) {
        return array();
        // No need to run if nothing is queued.
    }
    return print_head_scripts();
}

WordPress Version: 4.3

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8.0
 *
 * @global WP_Scripts $wp_scripts
 *
 * @return array
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!$wp_scripts instanceof WP_Scripts) {
        return array();
        // no need to run if nothing is queued
    }
    return print_head_scripts();
}

WordPress Version: 4.2

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8.0
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!$wp_scripts instanceof WP_Scripts) {
        return array();
        // no need to run if nothing is queued
    }
    return print_head_scripts();
}

WordPress Version: 3.9

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8.0
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        return array();
    }
    // no need to run if nothing is queued
    return print_head_scripts();
}

WordPress Version: 3.8

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        return array();
    }
    // no need to run if nothing is queued
    return print_head_scripts();
}

WordPress Version: 3.7

/**
 * Prints the script queue in the HTML head on the front end.
 *
 * Postpones the scripts that were queued for the footer.
 * wp_print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8
 */
function wp_print_head_scripts()
{
    if (!did_action('wp_print_scripts')) {
        do_action('wp_print_scripts');
    }
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        return array();
    }
    // no need to run if nothing is queued
    return print_head_scripts();
}