I fixed the first bug thanks, I added that later when I realized by making that change it could be used for any hierarchical post type and needed to make sure the post_id was set to get the post type.
But, for you’re second one, if you change that then you may have trouble and there is a reason that I do get ancestors on the parent id rather than the post id. When you change the parent of a page this does not become effective until after the post is saved. The AJAX call includes the new parent. Get ancestors on the post ID in the AJAX call can still return the same list of ancestors even if the depth has not changed. And while I could combine that into a single line it is more clear what is being done with it on two lines. Code clarity is more important to me than code brevity.
Yes, it might be nice to have this is the core of ACF, I can’t do that. I also know that the developer like to keep ACF to what will be used by the majority, among other things. While this could be useful for some I don’t know if it would be useful to most people. That’s why he’s made sure there are plenty of hooks so that we can make modifications.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!