Home › Forums › Backend Issues (wp-admin) › Restrict meta value to only be assigned once › Reply To: Restrict meta value to only be assigned once
Great John thanks for the link!
Looks like this could point me in the right direction..
My situation is slightly more complex as I need prevent duplicate values only in posts that share a taxonomy.
For example, let’s say my CPT is called ‘knowledge base’ and I have a custom taxonomy called ‘topics’ with 5 terms ‘topic A, topic B, topic C, topic D, topic E,’.
I also have a numeric meta key called ‘top_four’, this determines the order of the top four post links displayed under the term name (the remaining posts are hidden via a read more button). So, with 5 terms I would need to apply the meta value of ‘1’ five times (each per taxonomy term), along with values 2,3 and 4.
You can see where my challenge starts to occur as the meta value needs to be duplicated 5 times in CPT, but only should be allowed to be used once within its term.
I am wondering if I can use a loop to apply the rule you outlined in your other post on a per term basis, maybe a foreach loop that applies the rule.
Thanks once again John
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.