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
1267  * @global bool $concatenate_scripts
1268  *
1269  * @return array
1270  */
1271 function print_head_scripts() {
1272      global $concatenate_scripts;
1273
1274      if ( ! did_action('wp_print_scripts') ) {
1275           /** This action is documented in wp-includes/functions.wp-scripts.php */
1276           do_action( 'wp_print_scripts' );
1277      }
1278
1279      $wp_scripts = wp_scripts();
1280
1281      script_concat_settings();
1282      $wp_scripts->do_concat = $concatenate_scripts;
1283      $wp_scripts->do_head_items();
1284
1285      /**
 
Line Code
1377  * @since 2.8.0
1378  *
1379  * @global WP_Scripts $wp_scripts
1380  *
1381  * @return array
1382  */
1383 function wp_print_head_scripts() {
1384      if ( ! did_action('wp_print_scripts') ) {
1385           /** This action is documented in wp-includes/functions.wp-scripts.php */
1386           do_action( 'wp_print_scripts' );
1387      }
1388
1389      global $wp_scripts;
1390
1391      if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
1392           return array(); // no need to run if nothing is queued
1393      }
1394      return print_head_scripts();
1395 }