Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_print_scripts

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
351  *
352  * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
353  * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
354  * Does make use of already instantiated $wp_scripts if present.
355  * Use provided wp_print_scripts hook to register/enqueue new scripts.
356  *
357  * @see WP_Scripts::print_scripts()
358  */
359 function wp_print_scripts( $handles = false ) {
360      do_action( 'wp_print_scripts' );
361      if ( '' === $handles ) // for wp_head
362           $handles = false;
363
364      global $wp_scripts;
365      if ( !is_a($wp_scripts, 'WP_Scripts') ) {
366           if ( !$handles )
367                return array(); // No need to instantiate if nothing's there.
368           else
369                $wp_scripts = new WP_Scripts();