[wp-trac] [WordPress Trac] #63086: Customizer: notice errror regarding WP_Theme::is_block_theme
WordPress Trac
noreply at wordpress.org
Mon Mar 17 00:01:44 UTC 2025
#63086: Customizer: notice errror regarding WP_Theme::is_block_theme
-------------------------------------------------+-------------------------
Reporter: wildworks | Owner: joemcgill
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.8
Component: Customize | Version:
Severity: normal | Resolution:
Keywords: has-testing-info has-unit-tests | Focuses:
needs-patch needs-testing |
-------------------------------------------------+-------------------------
Comment (by peterwilsoncc):
Replying to [comment:17 dinhtungdu]:
> What I'm trying to prove is that it's fine to call
`WP_Theme::is_block_theme()` early, as long as we call it after theme
directories registration. So the early return and warning added in [59968]
should be removed.
I've done some quick testing and you are correct. The notice is protecting
against calls to the method much later than it needs to be.
The issue in #63062 arose not because the method was called before themes
were set up, but because the method was called before theme directories
were set up. The directories are configured prior to plugins being loaded.
Perhaps the test should be:
{{{#!php
<?php
if ( empty( $GLOBALS['wp_theme_directories'] ) ) {
_doing_it_wrong( __METHOD__, __( 'This method should not be called
before theme directories are set up.' ), '6.8.0' );
return false;
}
}}}
Possibly with some consideration for the possibility of `define(
'WP_USE_THEMES', false );`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63086#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list