wp_print_scripts

Advertisement

Summery Summery

Prints scripts in document head that are in the $handles queue.

Syntax Syntax

wp_print_scripts( string|bool|array $handles = false )

Description Description

Called by admin-header.php and ‘wp_head’ hook. Since it is called by wp_head on every page load, the function does not instantiate the WP_Scripts object unless script names are explicitly passed. Makes use of already-instantiated $wp_scripts global if present. Use provided ‘wp_print_scripts’ hook to register/enqueue new scripts.

Parameters Parameters

$handles

(string|bool|array) (Optional) Scripts to be printed. Default 'false'.

Default value: false

Return Return

(string[]) On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.

Source Source

File: wp-includes/functions.wp-scripts.php

/**
 * Prints scripts in document head that are in the $handles queue.
 *
 * Called by admin-header.php and {@see 'wp_head'} hook. Since it is called by wp_head on every page load,
 * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
 * Makes use of already-instantiated $wp_scripts global if present. Use provided {@see 'wp_print_scripts'}
 * hook to register/enqueue new scripts.
 *
 * @see WP_Scripts::do_item()
 * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
 *
 * @since 2.1.0
 *
 * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
 * @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
 */
function wp_print_scripts( $handles = false ) {
	global $wp_scripts;

	/**
	 * Fires before scripts in the $handles queue are printed.

Advertisement

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

See also See also

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.