[wp-trac] [WordPress Trac] #63086: Customizer: notice errror regarding WP_Theme::is_block_theme
WordPress Trac
noreply at wordpress.org
Tue Mar 18 15:52:42 UTC 2025
#63086: Customizer: notice errror regarding WP_Theme::is_block_theme
-------------------------------------------------+-------------------------
Reporter: wildworks | Owner: joemcgill
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.8
Component: Customize | Version: trunk
Severity: normal | Resolution:
Keywords: has-testing-info dev-feedback | Focuses:
needs-testing |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-testing-info has-patch dev-feedback => has-testing-info
dev-feedback needs-testing
* status: closed => reopened
* resolution: fixed =>
Comment:
I've been exploring this thing a little bit more because, don't ask me
why, I still feel there is a pebble in my shoe. After breaking my head in
[https://github.com/WordPress/wordpress-develop/pull/8509 this completely
failed PR] I found some inconsistencies in the code that I could not
clearly describe until now.
The thing is that there is something strange in the code: After the last
post of @dinhtungdu that references to one of the blocks of code I was
finding massive troubles, something weird in the code caught my eye, a
little to the bottom of the lines that he tracked down:
[https://github.com/wordpress/wordpress-
develop/blob/001a86a7ca833535533e59dc59babddc50fe2afa/src/wp-includes
/class-wp-theme.php#L421-L424 This lines]
In these lines, the comment says:
{{{
// If we got our data from cache, we can assume that 'template' is
pointing to the right place.
}}}
This is the first block of code that `wp_is_block_theme()` accesses (more
specifically via `wp_get_theme()`)
The thing is that more to the bottom there is another very similar block
https://github.com/WordPress/wordpress-
develop/blob/001a86a7ca833535533e59dc59babddc50fe2afa/src/wp-includes
/class-wp-theme.php#L469
That says:
{{{
// Set the parent if we're a child theme.
}}}
Ngl, I'm getting a little bit lost in all these blocks of code that repeat
code over and over again (maybe @spacedmonkey could lend a hand here
because he is the creator of all these blocks of code only 1 year and a
half ago)
But the reality is that if I make this conditional not pass in this first
interaction, for example, by adding an empty and innocuous `index.php` to
our example child theme
```
https://github.com/wordpress/wordpress-
develop/blob/001a86a7ca833535533e59dc59babddc50fe2afa/src/wp-includes
/class-wp-theme.php#L421-L424
```
So it jumps into the next conditional block:
https://github.com/WordPress/wordpress-
develop/blob/001a86a7ca833535533e59dc59babddc50fe2afa/src/wp-includes
/class-wp-theme.php#L469-L470
The whole issue is solved and the child plugin loads correctly without the
errors we found in #63062
[[Image(https://i.imgur.com/K73gFKd.png)]]
Conclusion: I feel that the issue goes beyond this simple notice and still
believe that the notice is not necessary and `wp_is_block_theme` should be
able to be called without trouble.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63086#comment:40>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list