In order to get the post ancestors (also called parents) simply use the get_post_ancestors() function. This function takes a single argument which can be either the post ID or post object, and return the ancestors IDs as an array. $ancestors = get_post_ancestors($post);
Thanks to Coen Jacobs for this great piece of code!
View the original article here
This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.
0 comments:
Post a Comment