diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index af66d02b94..477a85fbef 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -500,8 +500,21 @@ function url_to_postid( $url ) { */ $url = apply_filters( 'url_to_postid', $url ); - $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) ); - $home_url_host = str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); + $url_host = parse_url( $url, PHP_URL_HOST ); + + if ( is_string( $url_host ) ) { + $url_host = str_replace( 'www.', '', $url_host ); + } else { + $url_host = ''; + } + + $home_url_host = parse_url( home_url(), PHP_URL_HOST ); + + if ( is_string( $home_url_host ) ) { + $home_url_host = str_replace( 'www.', '', $home_url_host ); + } else { + $home_url_host = ''; + } // Bail early if the URL does not belong to this site. if ( $url_host && $url_host !== $home_url_host ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index c1aee4edbd..92d8816795 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-beta2-54363'; +$wp_version = '6.1-beta2-54364'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.