[wp-trac] [WordPress Trac] #63086: Customizer: notice errror regarding WP_Theme::is_block_theme

WordPress Trac noreply at wordpress.org
Sat Mar 15 00:51:04 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 needs-unit-tests    |     Focuses:
  needs-refresh                                  |
-------------------------------------------------+-------------------------
Changes (by dinhtungdu):

 * keywords:  has-testing-info has-patch has-unit-tests => has-testing-info
     needs-unit-tests needs-refresh


Comment:

 @SirLouen I tested your snippet and I can see the difference after
 switching: the warning and value of `$is_block_theme` is `false` when
 using the `plugins_loaded` callback. Is that the difference you're talking
 about?

 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 removed the early return and warning from `WP_Theme::is_block_theme()`
 and tested your snippet against four types of themes, the value of
 `$is_block_theme` was correct in all cases, either with `plugins_loaded`
 or `after_setup_theme`:
 - Block parent theme.
 - Block child theme.
 - Classic parent theme.
 - Classic child theme.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63086#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list