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