| 32 | ---- |
| 33 | The 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 | |
| 35 | By forcing switch_theme() to always save the roots, we're able to bypass the issue completely. |
| 36 | |
| 37 | Conversely, 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 | |
| 39 | This results in two additional options (even when there are never multiple theme roots) which sucks, but it always fixes the bug. |
| 40 | |
| 41 | If 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. |