[wp-trac] [WordPress Trac] #43228: register_theme_directory() needs to delete the `theme_roots` transient

WordPress Trac noreply at wordpress.org
Wed Mar 7 06:17:23 UTC 2018


#43228: register_theme_directory() needs to delete the `theme_roots` transient
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:
     Type:  defect (bug)                         |  johnbillion
 Priority:  normal                               |      Status:  reopened
Component:  Themes                               |   Milestone:  5.0
 Severity:  normal                               |     Version:
 Keywords:  has-patch has-unit-tests dev-        |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------

Comment (by dd32):

 `register_theme_directory()` is intended to run on every page load AFAICT,
 so ultimately deleting the `theme_roots` transient or `update_themes`
 option isn't a viable option for calling within
 `register_theme_directory()`.

 I suspect that calling `search_theme_directories( true )` within the
 branch that actually appends within `register_theme_directory()` will be a
 bit better, but it'll still cause unexpected IO to happen when the theme
 roots hasn't actually changed from what's in the transient (ie. this
 directory was registered on the last page load too).

 I think that `search_theme_directories()` and `get_theme_roots()` needs to
 hash `$wp_theme_directories` and include that as part of it's transient
 name, which should solve both the reported issue and the issue of extra
 IO.

 Either way, The patch as committed needs reverting.

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


More information about the wp-trac mailing list