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

WordPress Trac noreply at wordpress.org
Fri Mar 14 14:24:17 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-patch needs-    |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------

Comment (by dinhtungdu):

 > If other code is calling that method too early without causing the same
 bug, then I’d like to investigate further to see if there is a better
 place for that warning. If not, then we could choose to keep the fix for
 that ticket in place while removing `the _doing_it_wrong()`.

 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:

 > Digging deeper into the Core to understand the issue, I found that:
 > * `wp_is_block_theme` doesn't need to be called after
 `after_theme_setup`, it just needs to be called after
 [https://github.com/WordPress/wordpress-
 develop/blob/32fe6af9c36e2b80e79a664fc6ae53d9c5cd3f9a/src/wp-
 settings.php#L519 theme directories registration].
 > * The initial issue with the child theme is caused by calling that
 function after [https://github.com/WordPress/wordpress-
 develop/blob/32fe6af9c36e2b80e79a664fc6ae53d9c5cd3f9a/src/wp-
 settings.php#L514 creating post types], which is before the theme
 directories registration.
 > * Moving that logic to `after_theme_setup`, as we did in this ticket, is
 enough to solve the issue.
 > * Plugins can never break the theme resolution because they are loaded
 [https://github.com/WordPress/wordpress-
 develop/blob/32fe6af9c36e2b80e79a664fc6ae53d9c5cd3f9a/src/wp-
 settings.php#L529-L557 after] theme directories registration.
 > So the warning and early return don't protect us from anything and
 should be removed.

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


More information about the wp-trac mailing list