Make WordPress Core

Ticket #31789: 31789.diff

File 31789.diff, 1.1 KB (added by mattwiebe, 9 years ago)
  • wp-admin/includes/theme.php

     
    408408 */
    409409function wp_prepare_themes_for_js( $themes = null ) {
    410410        $current_theme = get_stylesheet();
     411        $prepared_themes = array();
    411412
     413        /**
     414         * Allow overriding the themes returned. Passing a non-empty array will cause
     415         * this function to exit early with that array of theme data. This can allow
     416         * for more aggressive caching on installs with a large number of themes.
     417         *
     418         * @since 4.2.0
     419         *
     420         * @param array  $prepared_themes  An associative array of theme data.
     421         * @param string $current_theme    The current theme slug.
     422         *
     423         * @return array Default empty array to skip, non-empty array to override.
     424         */
     425        $prepared_themes = apply_filters( 'pre_wp_prepare_themes_for_js', $prepared_themes, $current_theme );
     426        if ( is_array( $prepared_themes ) && ! empty( $prepared_themes ) ) {
     427                return $prepared_themes;
     428        }
     429
    412430        // Make sure the current theme is listed first.
    413431        $prepared_themes = array( $current_theme => array() );
    414432