I have an URL (such as the URL /sample-page/), I need the corresponding object ID. How?
|
|
|
Try this function:
The WordPress codex is your friend. A quick Google search could have provided the answer. |
|||
|
|
|
Use Unlike For a usage example see my answer to Get current term's ID. |
|||
|
|
|
The other answers are valid, but just to add another (usually unknown, but very usefull ) method that is supplied by a function called :
It is worthy to note that the path parameter can even take a SLUG as parameter. Example :
then you could use |
|||
|
|
|
I had the same problem, only with custom post types. Unfortunately If you have the permalink of the URL, then:
|
|||
|
|
