I have an URL (such as the URL /sample-page/
), I need the corresponding object ID. How?
4 Answers
Try this function:
url_to_postid( $url );
The WordPress codex is your friend. A quick Google search could have provided the answer.