Home › Forums › General Issues › Relationship Field and Prev/Next Posts › Reply To: Relationship Field and Prev/Next Posts
You cannot use the built in previous and next post links because the post being shown is not related to other posts in the DB, it is related to other posts in a relationship field in ACF.
The major issue here is “what relationship field”. You could have several relationship fields. How do you know that someone clicked on a related post link in another post to get to the current post? What relationship field did was used to show that link?
So you need 2 pieces of information that are not readily available when a post is shown.
Given this information you would get the relationship field from the original post and loop though the posts in that relationship field to determine the post before and after the current post in that field.
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.