Getting the top level permalink using get_post_ancestors() October 13, 2022 by Tarik Billa You may want to try get_permalink() ie: get_permalink( end($parents) ). 🙂