Support

Account

Home Forums General Issues Allow option only once for posts

Solved

Allow option only once for posts

  • I have an “set as default” option to a custom post type but I only want that option to be available or not disabled if no post has been marked “as default” previously.

    So a sort of conditional logic but across all posts in my post type.

    Is that possible and if so, how would I go about it?

  • I would suggest that rather than having this setting on every post that you instead create an options page that has a post object field to allow for the selection of the default” post.

    To do this on every post you will need to create an acf/load_field filter https://www.advancedcustomfields.com/resources/acfload_field/ and do a query in this filter to see if there is another post that already has the value set and if so then disable the field.

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

The topic ‘Allow option only once for posts’ is closed to new replies.