| 682 | | if ( count( $wp_theme_directories ) > 1 ) { |
| 683 | | update_option( 'template_root', get_raw_theme_root( $template, true ) ); |
| 684 | | update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) ); |
| | 682 | // Get current theme roots |
| | 683 | $template_root = get_option( 'template_root' ); |
| | 684 | $stylesheet_root = get_option( 'stylesheet_root' ); |
| | 685 | |
| | 686 | // Loop through themes and check for root mismatch. If we find a mismatch, |
| | 687 | // only update the option if the root is not '/themes' to prevent adding |
| | 688 | // useless options to the database. |
| | 689 | foreach ( get_site_transient( 'theme_roots' ) as $theme => $root ) { |
| | 690 | |
| | 691 | // Template |
| | 692 | if ( ( $template == $theme ) && ( $root != $template_root ) ) { |
| | 693 | |
| | 694 | // Don't set root to default location |
| | 695 | if ( '/themes' == $root ) { |
| | 696 | delete_option( 'template_root' ); |
| | 697 | } else { |
| | 698 | update_option( 'template_root', $root ); |
| | 699 | } |
| | 700 | } |
| | 701 | |
| | 702 | // Stylesheet |
| | 703 | if ( ( $stylesheet == $theme ) && ( $root != $stylesheet_root ) ) { |
| | 704 | |
| | 705 | // Don't set root to default location |
| | 706 | if ( '/themes' == $root ) { |
| | 707 | delete_option( 'stylesheet_root' ); |
| | 708 | } else { |
| | 709 | update_option( 'stylesheet_root', $root ); |
| | 710 | } |
| | 711 | } |