Get the object ID by URL

Try this function:

url_to_postid( $url );

The WordPress codex is your friend. A quick Google search could have provided the answer.

Leave a Comment