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
195  *
196  * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
197  * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
198  * Does make use of already instantiated $wp_scripts if present.
199  * Use provided wp_print_scripts hook to register/enqueue new scripts.
200  *
201  * @see WP_Scripts::print_scripts()
202  */
203 function wp_print_scripts( $handles = false ) {
204      do_action( 'wp_print_scripts' );
205      if ( '' === $handles ) // for wp_head
206           $handles = false;
207
208      global $wp_scripts;
209      if ( !is_a($wp_scripts, 'WP_Scripts') ) {
210           if ( !$handles )
211                return array(); // No need to instantiate if nothing's there.
212           else
213                $wp_scripts = new WP_Scripts();