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

WordPress Trac noreply at wordpress.org
Mon Mar 17 16:30:03 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 afragen):

 @joemcgill I agree that throwing an error when someone is calling and
 using the function inappropriately is warranted, however, it is clear that
 any properly loaded plugin may call `wp_get_themes()` resulting in a call
 to `WP_Theme::is_block_theme()` which calls
 `wp_get_themes()->is_block_theme()`. Bearing in mind that
 `wp_get_themes()` can call `new WP_Theme` whose constructor may call
 `$this->is_block_theme()` too.

 There's a huge vicious circle here that simply doesn't seem to apply to
 plugins calling `wp_get_themes()`.

 Somehow limiting this error only to when themes are calling these
 functions seems more appropriate. Not sure how that would be accomplished.

 I'm actually not certain if your suggestion to move the warning to
 `wp_is_block_theme()` is the solution. I use this call in plugins as well
 and I don't know if it will trigger this warning.

 I'm happy to help test this.

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


More information about the wp-trac mailing list