Home Forums General Issues ACF Relationship Field and adding a post not chosen by field


ACF Relationship Field and adding a post not chosen by field

  • Hi All,

    I’m building a slider component for a website using the Relationship field so it can be sorted and such. The client will be able to choose from the standard posts that they want to feature on the homepage.

    My concern is that when I hand it over to the client, I have built the slider to work with 4 posts chosen from the field. I can set a maximum number of posts, but there is no minimum value to set. I fear they will chose 3 and then wonder why there is an empty space in the slider navigation.

    Is it possible to set a minimum number of posts within the relationship field?

    Or is possible to set within the post data a statement that checks the number of chosen posts, and if they do not match 4, then I can push an additional post into the array?


  • I actually solved this issue. Instead of the Relationship field, I used a Repeater field / Post Object combination, where I set min-max row counts to 4, and then made the Post object fields required. If no post is chosen, it just defaults to the most recent post/default selected option on the Post Object field (as long as you don’t choose “Allow Null” as an option)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.