I have an url that looks like this
http://apploadny.appload.nu/tjanster/webbutveckling/
I want to get the ID of the page “tjanster”, how can i do that?
Leave a Reply
You must be logged in to post a comment.
I have an url that looks like this
http://apploadny.appload.nu/tjanster/webbutveckling/
I want to get the ID of the page “tjanster”, how can i do that?
You must be logged in to post a comment.
I think what you need is:
For more info check: http://codex.wordpress.org/Function_Reference/get_post_ancestors
I think a better solution than @alexleonard ‘s is to use the
parent_id
parameter of the post object.Haven’t tested that, so make sure you check for spelling mistakes and such.