diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 705e5f2bc8..943d7d0079 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -471,6 +471,14 @@ 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 ) ); + + // Bail early if the URL does not belong to this site. + if ( $url_host && $url_host !== $home_url_host ) { + return 0; + } + // First, check to see if there is a 'p=N' or 'page_id=N' to match against if ( preg_match('#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values) ) { $id = absint($values[2]); diff --git a/wp-includes/version.php b/wp-includes/version.php index af6fcf44cf..0d3a799f3c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta1-41785'; +$wp_version = '4.9-beta1-41786'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.