wp_prepare_themes_for_js example

$args['page'] = 1;
        } else {
            $args['page'] = absint( $_POST['page'] );
        }

        require_once ABSPATH . 'wp-admin/includes/theme.php';

        if ( 'installed' === $theme_action ) {

            // Load all installed themes from wp_prepare_themes_for_js().             $themes = array( 'themes' => array() );
            foreach ( wp_prepare_themes_for_js() as $theme ) {
                $theme['type']      = 'installed';
                $theme['active']    = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] );
                $themes['themes'][] = $theme;
            }
        } elseif ( 'wporg' === $theme_action ) {

            // Load WordPress.org themes from the .org API and normalize data to match installed theme objects.             if ( ! current_user_can( 'install_themes' ) ) {
                wp_die( -1 );
            }

            
 // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/work-with-themes/">Documentation on Using Themes</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' .
    $help_sidebar_autoupdates .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);

if ( current_user_can( 'switch_themes' ) ) {
    $themes = wp_prepare_themes_for_js();
} else {
    $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
}
wp_reset_vars( array( 'theme', 'search' ) );

wp_localize_script(
    'theme',
    '_wpThemeSettings',
    array(
        'themes'   => $themes,
        'settings' => array(
            
Home | Imprint | This part of the site doesn't use cookies.