Get Ancestor featured image
Given this hierarchy: Page 1 Page 2 Page 3 Page 4 This line, where $post represents Page 4: $parents = get_post_ancestors( $post->ID ); Will return 3 IDs, for these pages, in this order: Page 3 Page 2 Page 1 So this line: $id = ($parents) ? $parents[count($parents)-1]: $post->ID; Is the equivalent of: $id = ($parents) … Read more