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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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

Source View

This hook occurs 2 times in this file.

Line Code
563  * print_footer_scripts() is called in the footer to print these scripts.
564  *
565  * @since 2.8
566  * @see wp_print_scripts()
567  */
568 function print_head_scripts() {
569      global $wp_scripts, $concatenate_scripts;
570
571      if ( ! did_action('wp_print_scripts') )
572           do_action('wp_print_scripts');
573
574      if ( !is_a($wp_scripts, 'WP_Scripts') )
575           $wp_scripts = new WP_Scripts();
576
577      script_concat_settings();
578      $wp_scripts->do_concat = $concatenate_scripts;
579      $wp_scripts->do_head_items();
580
581      if ( apply_filters('print_head_scripts', true) )
 
Line Code
640  * Prints the script queue in the HTML head on the front end.
641  *
642  * Postpones the scripts that were queued for the footer.
643  * wp_print_footer_scripts() is called in the footer to print these scripts.
644  *
645  * @since 2.8
646  */
647 function wp_print_head_scripts() {
648      if ( ! did_action('wp_print_scripts') )
649           do_action('wp_print_scripts');
650
651      global $wp_scripts;
652
653      if ( !is_a($wp_scripts, 'WP_Scripts') )
654           return array(); // no need to run if nothing is queued
655
656      return print_head_scripts();
657 }
658