Make WordPress Core

Opened 4 years ago

Last modified 4 years 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: anonymized_16042088's profile anonymized_16042088 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4
Component: Themes Keywords:
Focuses: template Cc:

Description

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

Sample folder structure:

/wp-content/themes/my-theme/templates/style.css
/wp-content/themes/my-theme/templates/functions.php
/wp-content/themes/my-theme/templates/index.php

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
4 years 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
4 years ago

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