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
13  * on every page load, the function does not instantiate the WP_Scripts object
14  * unless script names are explicitly passed. Does make use of already
15  * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
16  * register/enqueue new scripts.
17  *
18  * @since r16
19  * @see WP_Dependencies::print_scripts()
20  */
21 function wp_print_scripts( $handles = false ) {
22      do_action( 'wp_print_scripts' );
23      if ( '' === $handles ) // for wp_head
24           $handles = false;
25
26      global $wp_scripts;
27      if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
28           if ( ! did_action( 'init' ) )
29                _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
30                     '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
31