Thursday, 15 September 2011

How to get post ancestors of a post?

In wordpress we have an option to assign a post as a child to another post. In order to get the ancestors of a post wordpress have an inbuilt function i.e.  get_post_ancestors( ).

This function will have one argument that can be either post id or post object and it returns the ancestor’s ids as an array. 


No comments:

Post a Comment