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
812  * @since 2.8.0
813  *
814  * @see wp_print_scripts()
815  */
816 function print_head_scripts() {
817      global $wp_scripts, $concatenate_scripts;
818
819      if ( ! did_action('wp_print_scripts') ) {
820           /** This action is documented in wp-includes/functions.wp-scripts.php */
821           do_action( 'wp_print_scripts' );
822      }
823
824      if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
825           $wp_scripts = new WP_Scripts();
826      }
827
828      script_concat_settings();
829      $wp_scripts->do_concat = $concatenate_scripts;
830      $wp_scripts->do_head_items();
 
Line Code
912  *
913  * Postpones the scripts that were queued for the footer.
914  * wp_print_footer_scripts() is called in the footer to print these scripts.
915  *
916  * @since 2.8.0
917  */
918 function wp_print_head_scripts() {
919      if ( ! did_action('wp_print_scripts') ) {
920           /** This action is documented in wp-includes/functions.wp-scripts.php */
921           do_action( 'wp_print_scripts' );
922      }
923
924      global $wp_scripts;
925
926      if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
927           return array(); // no need to run if nothing is queued
928      }
929      return print_head_scripts();
930 }