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

Checks are supposedly from the hosted site blog.


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


(int) Post ID, or 0 on failure.


function url_to_postid($url) {
	global $wp_rewrite;

	 * Filter 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 );

	// 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]);
		if ( $id )
			return $id;

	// Check to see if we are using rewrite rules
95 more lines...
WP Trac GitHub

Link here