How to get the post_id of a page that isn't at the root
-
Hello,
I manage the get the post ID by using this API call:
https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/posts/slug:%24post_slug/
But only when the page is at the root. For example, in my site http://mplsinthesdnera.net, I can get the post ID of:
http://mplsinthesdnera.net/configuration-repository/ by supplying the slug ‘configuration-repository’.
However, I found no way to get the post ID of:
http://mplsinthesdnera.net/configuration-repository/chapter-1-configs/
Every syntax I tried in the API failed to get the ID.
-
I tested this using “mplsinthesdnera.net” as the first parameter and “configuration-repository/chapter-1-configs” as the second parameter with the api call you mentioned, and I see that “ID”: 307 is returned.
Did you try the syntax “configuration-repository/chapter-1-configs” already?
-
Thank you very much!
Your confirmation made me try further:
‘configuration-repository%2Fchapter-1-configs’ worked for me.
- The topic ‘How to get the post_id of a page that isn't at the root’ is closed to new replies.