mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Themes: Add a filter to short-circuit wp_prepare_themes_for_js()
.
props mattwiebe, DrewAPicture. fixes #31789. Built from https://develop.svn.wordpress.org/trunk@31943 git-svn-id: http://core.svn.wordpress.org/trunk@31922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5fae37471a
commit
efb2740e88
@ -409,8 +409,26 @@ function themes_api( $action, $args = null ) {
|
||||
function wp_prepare_themes_for_js( $themes = null ) {
|
||||
$current_theme = get_stylesheet();
|
||||
|
||||
/**
|
||||
* Filter 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 null|array $themes An array of WP_Theme objects to prepare, if any.
|
||||
* @param string $current_theme The current theme slug.
|
||||
*/
|
||||
$prepared_themes = (array) apply_filters( 'pre_wp_prepare_themes_for_js', array(), $themes, $current_theme );
|
||||
|
||||
if ( ! empty( $prepared_themes ) ) {
|
||||
return $prepared_themes;
|
||||
}
|
||||
|
||||
// Make sure the current theme is listed first.
|
||||
$prepared_themes = array( $current_theme => array() );
|
||||
$prepared_themes[ $current_theme ] = array();
|
||||
|
||||
if ( null === $themes ) {
|
||||
$themes = wp_get_themes( array( 'allowed' => true ) );
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-beta3-31942';
|
||||
$wp_version = '4.2-beta3-31943';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user