diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index 5fd46396af..0b12855b0e 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -211,7 +211,9 @@ class WP_Filesystem_Base { $newdir = trailingslashit(path_join($base, $key)); if ( $this->verbose ) printf( __('Changing to %s') . '
', $newdir ); - if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) ) + // only search for the remaining path tokens in the directory, not the full path again + $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); + if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) ) return $ret; } }