Home › Forums › Backend Issues (wp-admin) › ACF Relationship Field giving error when added more than one post
Hey all, I’m been beating my head against this issue for the last day and have not been able to track down what is causing this issue.
So, right now I have a custom post type I created called “gallery_slides” that we are using to make individual slides for a bootstrap carousel gallery.
I have created two separate ACF blocks:
Everything is working fine for the CPT portion so far. The gallery slides are being saved correctly and I can write them all to a page using WP_Query without any issues.
The problem comes into play when I try the add “gallery slides” using the ACF Relationship field in the block designed to render them to a page. When I add the first one, everything seems fine, when I add a second one from the relationship list, it immediately breaks the block, giving this error:
“This block has encountered an error and cannot be previewed.”
When I check the console, it’s also giving me a “TypeError: e is null, jQuery 5, onAppend…” error. When I click on the post.php link to see where the error occurred, it just says “originalMethod(…args);” If I remove the WP_Query and just try to var_dump the relationship field with a foreach() it still does the same thing.
If I save and refresh the page, the “gallery slides” I chose have been correctly saved, but if I change anything within the relationship field it breaks again. If I preview it, the “gallery slides” are being correctly rendered on the front end.
I have two other custom post types that are being used the same way and they work perfectly fine with the relationship field. They take the relationship field as a variable and run it through a foreach() that does a WP_Query for each one selected.
Does anyone have any idea what might be causing this? I feel like it’s something simple that I overlooking, so any help would be greatly appreciated.
You must be logged in to reply to this topic.
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.