wppaste
WordPress

apply_filters( 'pre_prepare_themes_for_js', array $prepared_themes, \WP_Theme[]|null $themes, string $current_theme )

Since
4.2.0
Filters theme data before it is prepared for JavaScript.

Description

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

Compatibility

WordPress
since 4.2.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$prepared_themesarray
An associative array of theme data. Default empty array.
$themes\WP_Theme[]|null
An array of theme objects to prepare, if any.
$current_themestring
The active theme slug.

Where this hook fires · 1

  • wp-admin/includes/theme.php:662wp_prepare_themes_for_js()

Source code

	 * @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.	 */	$prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme ); 	if ( ! empty( $prepared_themes ) ) {		return $prepared_themes;	} 	// Make sure the active theme is listed first.

Changelog

Introduced in 4.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.