Make WordPress Core

Ticket #31789: 31789.1.diff

File 31789.1.diff, 1.2 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 null|array $themes           An array of WP_Theme objects to prepare, if any.
     422         * @param string     $current_theme    The current theme slug.
     423         *
     424         * @return array Default empty array to skip, non-empty array to override.
     425         */
     426        $prepared_themes = apply_filters( 'pre_wp_prepare_themes_for_js', $prepared_themes, $themes, $current_theme );
     427        if ( is_array( $prepared_themes ) && ! empty( $prepared_themes ) ) {
     428                return $prepared_themes;
     429        }
     430
    412431        // Make sure the current theme is listed first.
    413432        $prepared_themes = array( $current_theme => array() );
    414433