Make WordPress Core


Ignore:
Timestamp:
03/29/2022 08:53:31 AM (3 years ago)
Author:
audrasjb
Message:

Themes: Hide block themes live preview link following installation.

Prevent the Customizer/Live Preview button from showing for installed block themes when on the theme installation page.

Props antonvlasenko, costdev, ironprogrammer.
Merges [52819] to the 5.9 branch.
Fixes #54878.

Location:
branches/5.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/src/wp-admin/theme-install.php

    r51923 r53008  
    3636}
    3737
    38 foreach ( $installed_themes as $k => $v ) {
    39     if ( false !== strpos( $k, '/' ) ) {
    40         unset( $installed_themes[ $k ] );
     38foreach ( $installed_themes as $theme_slug => $theme_data ) {
     39    // Ignore child themes.
     40    if ( str_contains( $theme_slug, '/' ) ) {
     41        unset( $installed_themes[ $theme_slug ] );
    4142    }
    4243}
     
    374375                    <# if ( data.customize_url ) { #>
    375376                        <# if ( ! data.active ) { #>
    376                             <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     377                            <# if ( ! data.block_theme ) { #>
     378                                <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
     379                            <# } #>
    377380                        <# } else { #>
    378381                            <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.