Only parse ancestor data when ancestors are known to exist

Removes the requirement for the global $post object