pre_prepare_themes_for_js
Filter HookDescription
Filters theme data before it is prepared for JavaScript. Passing a non-empty array will result in wp_prepare_themes_for_js() returning early with that value instead.Hook Information
File Location |
wp-admin/includes/theme.php
View on GitHub
|
Hook Type | Filter |
Line Number | 666 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$prepared_themes
|
An associative array of theme data. Default empty array. |
WP_Theme[]|null
|
$themes
|
An array of theme objects to prepare, if any. |
string
|
$current_theme
|
The active theme slug. |
Usage Examples
Basic Usage
<?php
// Hook into pre_prepare_themes_for_js
add_filter('pre_prepare_themes_for_js', 'my_custom_filter', 10, 3);
function my_custom_filter($prepared_themes, $themes, $current_theme) {
// Your custom filtering logic here
return $prepared_themes;
}
Source Code Context
wp-admin/includes/theme.php:666
- How this hook is used in WordPress core
<?php
661 *
662 * @param array $prepared_themes An associative array of theme data. Default empty array.
663 * @param WP_Theme[]|null $themes An array of theme objects to prepare, if any.
664 * @param string $current_theme The active theme slug.
665 */
666 $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );
667
668 if ( ! empty( $prepared_themes ) ) {
669 return $prepared_themes;
670 }
671
PHP Documentation
<?php
/**
* Filters theme data before it is prepared for JavaScript.
*
* Passing a non-empty array will result in wp_prepare_themes_for_js() returning
* early with that value instead.
*
* @since 4.2.0
*
* @param array $prepared_themes An associative array of theme data. Default empty array.
* @param WP_Theme[]|null $themes An array of theme objects to prepare, if any.
* @param string $current_theme The active theme slug.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-admin/includes/theme.php
Related Hooks
Related hooks will be displayed here in future updates.