Make WordPress Core

Changes between Version 4 and Version 5 of Ticket #22252


Ignore:
Timestamp:
10/22/2012 03:41:10 AM (11 years ago)
Author:
johnjamesjacoby
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22252 – Description

    v4 v5  
    3030* Remove count( $wp_theme_directories ) check from switch_theme(). This forces the theme root to be accurate every time the theme switches, regardless of how many directories are ever registered. In my opinion, this is the most sensible option. (Patch attached)
    3131* Improve search_theme_directories() to update 'stylesheet_root' and 'template_root' when 'theme_roots' transient doesn't match up. This works because we're already looping through the $cached_roots to make sure each theme is valid. The problem here is we're depending on the expiration of the transient, and doing additional logic each time that happens. (No patch attached)
     32----
     33The crux of the issue: counting $wp_theme_directories isn't a reliable way to guarantee the current theme and its _root's match. This bug doesn't occur if more than 1 new theme directory is registered, because switch_theme() will always update the theme root in that circumstance.
     34
     35By forcing switch_theme() to always save the roots, we're able to bypass the issue completely.
     36
     37Conversely, the only reason to store the _root's is when register_theme_directory() is used. If it's never used, it's never a problem. If it's always used, it's never a problem. It's only a problem when switching between it being used once, and then not at all.
     38
     39This results in two additional options (even when there are never multiple theme roots) which sucks, but it always fixes the bug.
     40
     41If we fix it in search_theme_directories(), we're able to update the _root's when they need it, but we're performing that extra logic on each iteration when the transients expire.