[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
Tue Jan 24 13:27:24 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:  gutenberg-merge has-patch has-unit-  |     Focuses:
  tests has-testing-info                         |  performance
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 Replying to [comment:89 spacedmonkey]:
 > It seems to me, that is there is a valid use case that the cache needs
 to be invalidated. A couple of cases off the top of my head.
 >
 > - Unit test runs.
 > - A plugin that switches theme depending on request, like mobile theme
 if the request is coming a phone.
 > - Customizor previewing new theme.

 For the unit test runs, the [https://github.com/WordPress/wordpress-
 develop/pull/3887 PR 3887] ignores the cache between tests.

 For theme switching and previewing, @flixos90 addressed [#comment:84 theme
 switching and previewing] as an unknown.

 >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".

 Rather than optimizing the function now for the unknown, the thought is to
 commit a lean approach, test and validate if it truly is a bug or not. If
 it is a bug that needs addressing, then follow-up with a bugfix.

 Do you agree with this lean static variable approach @spacedmonkey?

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


More information about the wp-trac mailing list