diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 754353878f..7d931bc6ea 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3254,7 +3254,7 @@ function wp_guess_url() { $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ); } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) { // Request is hitting a file above ABSPATH - $subdirectory = str_replace( $script_filename_dir, '', $abspath_fix ); + $subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) ); // Strip off any file/query params from the path, appending the sub directory to the install $path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory; } else {