Home › Forums › Backend Issues (wp-admin) › Repeater to manage a custom post type › Reply To: Repeater to manage a custom post type
I do, in a way, understand what you are doing. I have a setup where I have a repeater field that lets the client add child posts in the same post type. My setup is different.
On save I have an acf/save_post action that looks at the repeater and compares it with the posts to child posts to see
1) What has been added
2) What has been deleted
and then I add or delete child posts as needed.
In my case I do not have an ID. the child posts are based on start and end date. If any start/end date combination is new I create a new post and for every existing child post if the start/end date combination does not exist then I delete that post.
In my case I store all the needed information in the child posts and not in the repeater.
Have you thought about having a post object field in the child post that points back to the parent instead of a value in the parent that is pointing to the child.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.