diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ba56521cf3..f013058d07 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -1679,7 +1679,7 @@ function wp_mkdir_p( $target ) { // We need to find the permissions of the parent folder that exists and inherit that. $target_parent = dirname( $target ); - while ( '.' != $target_parent && ! is_dir( $target_parent ) ) { + while ( '.' != $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { $target_parent = dirname( $target_parent ); }