Examine a URL and try to determine the post ID it represents.

Checks are supposedly from the hosted site blog.

Signature

url_to_postid( $url )
url
 (string) Permalink to check.

Return

(int) Post ID, or 0 on failure.

Source

function url_to_postid( $url ) {
	global $wp_rewrite;

	/**
	 * Filters the URL to derive the post ID from.
	 *
	 * @since 2.2.0
	 *
	 * @param string $url The URL to derive the post ID from.
	 */
	$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;
	}

126 more lines...
WP Trac GitHub

Link here