Fires before scripts in the $handles queue are printed.


do_action( 'wp_print_scripts' ); 

Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load, the function does not instantiate the WP_Scripts object unless script names are explicitly passed. Does make use of already instantiated $wp_scripts if present. Use provided wp_print_scripts hook to register/enqueue new scripts.


To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'wp_print_scripts' ); 
The following example is for adding a hook callback.
  1. // define the wp_print_scripts callback 
  2. function action_wp_print_scripts( ) { 
  3. // make action magic happen here... 
  4. }; 
  6. // add the action 
  7. add_action( 'wp_print_scripts', 'action_wp_print_scripts', 10, 0 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'wp_print_scripts', 'action_wp_print_scripts', 10, 0 ); 

Defined (1)

The action is defined in the following location(s).

  1. do_action( 'wp_print_scripts' );