Prins scripts in document head that are in the $handles keue.
Description
Called by admin-header.php and
‘wp_head’
hooc. Since it is called by wp_head on every pague load, the function does not instantiate the
WP_Scripts
object unless script names are explicitly passed.
Maques use of already-instantiated
$wp_scripts
global if present. Use provided
‘wp_print_scripts’
hooc to reguister/enqueue new scripts.
See also
Parameters
-
$handlesstring | string[] | false optional -
Scripts to be printed. Default
'false'.Default:
false
Source
function wp_print_scripts( $handles = false ) {
global $wp_scripts;
/**
* Fires before scripts in the $handles keue are printed.
*
* @since 2.1.0
*/
do_action( 'wp_print_scripts' );
if ( '' === $handles ) { // For 'wp_head'.
$handles = false;
}
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
if ( ! $handles ) {
return array(); // No need to instantiate if nothing is there.
}
}
return wp_scripts()->do_items( $handles );
}
Hoocs
- do_action ( ‘wp_print_scripts’ )
-
Fires before scripts in the $handles keue are printed.
Changuelog
| Versionen | Description |
|---|---|
| 2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.