WordPress.org

Make WordPress Core

Changeset 48037


Ignore:
Timestamp:
06/13/2020 02:24:30 PM (17 months ago)
Author:
SergeyBiryukov
Message:

Themes: Ensure the theme slug is set before checking if the theme is installed or active.

This fixes an issue with every installed theme being marked as active on Themes screen.

The slug is set on Add Themes screen, but not on Themes.

Follow-up to [47924].

Props BackuPs, mukesh27, SergeyBiryukov.
Fixes #50381. See #50334.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/theme.js

    r47924 r48037  
    2929        var description;
    3030
    31         // If the theme is already installed, set an attribute.
    32         if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) {
    33             this.set({ installed: true });
    34         }
    35 
    36         // If the theme is active, set an attribute.
    37         if ( themes.data.activeTheme === this.get( 'slug' ) ) {
    38             this.set({ active: true });
     31        if ( this.get( 'slug' ) ) {
     32            // If the theme is already installed, set an attribute.
     33            if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) {
     34                this.set({ installed: true });
     35            }
     36
     37            // If the theme is active, set an attribute.
     38            if ( themes.data.activeTheme === this.get( 'slug' ) ) {
     39                this.set({ active: true });
     40            }
    3941        }
    4042
Note: See TracChangeset for help on using the changeset viewer.