#58405 closed enhancement (fixed)
Use is_block_theme in WP_Theme
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | good-first-bug has-patch needs-testing commit |
Focuses: | Cc: |
Description (last modified by )
In line of 366 / 367 of the WP_Theme
class, there are manual calls to if files exists. However, in this context we can use the method is_block_theme
. This remove repeated code and hit an existing cache.
Attachments (3)
Change History (21)
This ticket was mentioned in PR #4514 on WordPress/wordpress-develop by Juzar10.
12 days ago
#1
- Keywords has-patch added
#2
@
9 days ago
- Description modified (diff)
- Keywords changes-requested added
Hi there!
Thanks for PR/Patch both of you.
@nihar007 in your patch do you use different approach then PR 4514? Instead of adding duplicate patch try you can check review the PR and share your feedback on it. Thanks!
#4
@
9 days ago
- Milestone changed from Future Release to 6.3
One of the two patches looks good. Moving into the 6.3 milestone.
To who is interested, this needs to be tested in classic and block themes, with and without child themes.
#5
@
9 days ago
Hi @mukesh27,
Thanks for you response.
I removed $theme_path variable. I think there is no necessity of $theme_path variable.
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
8 days ago
#8
@
8 days ago
- Keywords needs-testing added
This ticket was discussed during the bug scrub. We agreed to add the needs-testing
keyword to indicate that the PR needs testing before commit consideration.
Additional props: @mukesh27 @oglekler
#9
@
6 days ago
- Keywords needs-testing-info added
@spacedmonkey From your earlier comment:
To who is interested, this needs to be tested in classic and block themes, with and without child themes.
Would you be able to add some testing instructions so that the Test Team can pick this up and cover possible Dashboard-based and code-based testing paths? Thanks!
@spacedmonkey commented on PR #4514:
5 days ago
#11
@mukeshpanchal27 @costdev Mind taking a look again?
#12
@
2 days ago
@costdev To ensure this statement is hit, create a theme with just a style.css file. You should see an error message in the theme screen in admin. I have provided a screenshot.
@spacedmonkey commented on PR #4514:
2 days ago
#13
@costdev If you are happy, I will commit.
#14
@
2 days ago
- Keywords commit added; changes-requested needs-testing-info removed
- Owner set to spacedmonkey
- Status changed from new to assigned
@costdev If you can test, then I will commit.
#15
@
2 days ago
Test Report
This report validates that the indicated patch addresses the issue.
Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/4514.diff
Steps to Test
- Create a theme with only a valid
style.css
and no other files. - Navigate to
Appearance > Themes
. - Apply the patch.
- Refresh the page.
Environment
- WordPress: 6.3-alpha-55505
- PHP: 7.4.33
- Server: Apache/2.4.56 (Ubuntu)
- Database: mysqli (Server: 5.7.41-0ubuntu0.18.04.1 / Client: mysqlnd 7.4.33)
- Browser: Chrome 114.0.0.0 (Windows 10/11)
- Theme: Twenty Twenty-Three 1.1
- MU-Plugins: None activated
- Plugins: None activated
Expected Results
- ✅ The following message should appear before and after the patch:
Actual Results
- ✅ The same message appeared before and after the patch.
2 days ago
#16
@spacedmonkey LGTM and tests well 👍
FYI, this patch brings an additional change (for the better, IMO):
trunk
uses file_exists()
rather than is_file()
, so it's actually possible to create templates/index.html
as a directory, and the "Broken Themes" message won't appear on the Appearances > Themes
screen. With this PR, the "Broken Themes" message appears as expected.
Trac ticket: https://core.trac.wordpress.org/ticket/58405