Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#50048 new defect (bug)

wp_ajax_update_theme is broken when updating themes whose styles.css file is not located in the root

Reported by: novecode Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4
Component: Themes Keywords:
Focuses: template Cc:


Cannot update themes using wp_ajax_update_theme when templates aren't located in the theme root folder.

Sample folder structure:


The template name is defined as "my-theme/templates", but "wp_ajax_update_theme" is striping the slash so it becomes "my-themetemplates". This is why it's unable to locate the theme and not starting the update process.

Reference: https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/includes/ajax-actions.php#L4118

Is this the desired behavior?

Change History (2)

#1 @Ipstenu
21 months ago

Based on the documentation - https://developer.wordpress.org/themes/basics/organizing-theme-files/#theme-folder-and-file-structure - there should always be a style.css in the main folder.

In fat there's a notice:

style.css should reside in the root directory of your theme not within the CSS directory.

So I would say yes, this is by design, and the real bug would be letting the theme load without the style.css in the correct location.

#2 @SergeyBiryukov
21 months ago

  • Component changed from General to Themes
Note: See TracTickets for help on using tickets.