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

WordPress Trac noreply at wordpress.org
Fri Mar 14 16:59:42 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 SirLouen):

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


Comment:

 Replying to [comment:14 dinhtungdu]:
 > From my investigation, I believe that it's safe for plugin to call
 `wp_is_block_theme()`. I'm copying my comment from
 https://core.trac.wordpress.org/ticket/63062#comment:30 for visibility:

 Try for example in a plugin adding this:

 {{{#!php
 <?php
 add_action('plugins_loaded', 'test_is_block_theme');
 function test_is_block_theme () {
     $is_block_theme = wp_get_theme()->is_block_theme();
     if ($is_block_theme) {
        //Whatever
     }
 });
 }}}

 And then switch `add_action('plugins_loaded', 'test_is_block_theme');` for
 `add_action('after_setup_theme', 'test_is_block_theme', 20);`

 Can you see the difference?

 From what I can understand, it's just a notice for developers that could
 be willing to use this method, not just for the core code itself.
 Maybe @joemcgill can provide more insight about this topic

 Anyway the last patches from @yogeshbhutkar are still not passing tests.

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


More information about the wp-trac mailing list