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
402  *
403  * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
404  * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
405  * Does make use of already instantiated $wp_scripts if present.
406  * Use provided wp_print_scripts hook to register/enqueue new scripts.
407  *
408  * @see WP_Scripts::print_scripts()
409  */
410 function wp_print_scripts( $handles = false ) {
411      do_action( 'wp_print_scripts' );
412      if ( '' === $handles ) // for wp_head
413           $handles = false;
414
415      global $wp_scripts;
416      if ( !is_a($wp_scripts, 'WP_Scripts') ) {
417           if ( !$handles )
418                return array(); // No need to instantiate if nothing's there.
419           else
420                $wp_scripts = new WP_Scripts();