Title: print_head_scripts
Published: April 25, 2014
Last modified: April 28, 2025

---

# print_head_scripts(): string[]

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#see-also)
 * [Return](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#wp--skip-link--target)

Prints the script queue in the HTML head on admin pages.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#description)󠁿

Postpones the scripts that were queued for the footer.
[print_footer_scripts()](https://developer.wordpress.org/reference/functions/print_footer_scripts/)
is called in the footer to print these scripts.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#see-also)󠁿

 * [wp_print_scripts()](https://developer.wordpress.org/reference/functions/wp_print_scripts/)

## 󠀁[Return](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#return)󠁿

 string[] Handles of the scripts that were printed.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#source)󠁿

    ```php
    function print_head_scripts() {
    	global $concatenate_scripts;

    	if ( ! did_action( 'wp_print_scripts' ) ) {
    		/** This action is documented in wp-includes/functions.wp-scripts.php */
    		do_action( 'wp_print_scripts' );
    	}

    	$wp_scripts = wp_scripts();

    	script_concat_settings();
    	$wp_scripts->do_concat = $concatenate_scripts;
    	$wp_scripts->do_head_items();

    	/**
    	 * Filters whether to print the head scripts.
    	 *
    	 * @since 2.8.0
    	 *
    	 * @param bool $print Whether to print the head scripts. Default true.
    	 */
    	if ( apply_filters( 'print_head_scripts', true ) ) {
    		_print_scripts();
    	}

    	$wp_scripts->reset();
    	return $wp_scripts->done;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/script-loader.php#L2126)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/script-loader.php#L2126-L2153)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#hooks)󠁿

 [apply_filters( ‘print_head_scripts’, bool $print )](https://developer.wordpress.org/reference/hooks/print_head_scripts/)

Filters whether to print the head scripts.

 [do_action( ‘wp_print_scripts’ )](https://developer.wordpress.org/reference/hooks/wp_print_scripts/)

Fires before scripts in the $handles queue are printed.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_scripts()](https://developer.wordpress.org/reference/functions/wp_scripts/)`wp-includes/functions.wp-scripts.php` |

Initializes $wp_scripts if it has not been set.

  | 
| [did_action()](https://developer.wordpress.org/reference/functions/did_action/)`wp-includes/plugin.php` |

Retrieves the number of times an action has been fired during the current request.

  | 
| [WP_Scripts::do_head_items()](https://developer.wordpress.org/reference/classes/wp_scripts/do_head_items/)`wp-includes/class-wp-scripts.php` |

Processes items and dependencies for the head group.

  | 
| [WP_Scripts::reset()](https://developer.wordpress.org/reference/classes/wp_scripts/reset/)`wp-includes/class-wp-scripts.php` |

Resets class properties.

  | 
| [script_concat_settings()](https://developer.wordpress.org/reference/functions/script_concat_settings/)`wp-includes/script-loader.php` |

Determines the concatenation and compression settings for scripts and styles.

  | 
| [do_action()](https://developer.wordpress.org/reference/functions/do_action/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to an action hook.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#)

| Used by | Description | 
| [wp_print_head_scripts()](https://developer.wordpress.org/reference/functions/wp_print_head_scripts/)`wp-includes/script-loader.php` |

Prints the script queue in the HTML head on the front end.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/print_head_scripts/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fprint_head_scripts%2F)
before being able to contribute a note or feedback.