pre_prepare_themes_for_js

Filters theme data before it is prepared for JavaScript.

Description

apply_filters( 'pre_prepare_themes_for_js', (array) $array, (null|array) $themes, (string) $current_theme ); 

Passing a non-empty array will result in wp_prepare_themes_for_js() returning early with that value instead.

Parameters (3)

0. $array (array) => array()
An associative array of theme data. Default empty array.
1. $themes (null|array)
An array of WP_Theme objects to prepare, if any.
2. $current_theme (string)
The current theme slug.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'pre_prepare_themes_for_js', $array, $themes, $current_theme ); 
  2.  
  3. if ( !empty( $array ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pre_prepare_themes_for_js callback 
  2. function filter_pre_prepare_themes_for_js( $array, $themes, $current_theme ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pre_prepare_themes_for_js', 'filter_pre_prepare_themes_for_js', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pre_prepare_themes_for_js', 'filter_pre_prepare_themes_for_js', 10, 3 ); 

Defined (1)

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

/wp-admin/includes/theme.php  
  1. $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );