[wp-trac] [WordPress Trac] #56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a public function

WordPress Trac noreply at wordpress.org
Mon Jan 23 16:19:29 UTC 2023


#56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a
public function
-------------------------------------------------+-------------------------
 Reporter:  oandregal                            |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.2
Component:  Themes                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback gutenberg-merge has-    |     Focuses:
  patch has-unit-tests has-testing-info          |  performance
-------------------------------------------------+-------------------------

Comment (by flixos90):

 @oandregal I understand the theoretical concern you're referring to, and
 it may indeed be a problem. But I think @Otto42 is right in that if this
 function was ever called in a situation where the theme is being switched,
 ''before'' it is switched, this would be a problem in the consuming code.

 Maybe this is happening somewhere in WordPress - maybe it is not. We don't
 know for sure, and as long as we don't know for sure I don't think it's
 worth optimizing for this "bug".

 If it is indeed a problem somewhere, we could easily fix it by making the
 static variable a map of `$theme_dir => $has_theme_json`, always relying
 on `get_stylesheet()` to make sure we act on the current theme. This
 should be straightforward, but I still think it is overkill in the current
 situation where we are just considering this as a theoretical concern. We
 still have all the betas ahead of us, so I think it's worth committing the
 simple solution, and if anything comes up we can see how to best approach
 a fix for that.

 My concluded suggestion here would be to proceed with the basic static
 variable cache and commit that. cc @hellofromTonya

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


More information about the wp-trac mailing list