I have an URL (such as the URL /sample-page/), I need the corresponding object ID. How?

4 Answers
4

Try this function:

url_to_postid( $url );

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

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *