Home › Forums › Backend Issues (wp-admin) › Restrict meta value to only be assigned once › Reply To: Restrict meta value to only be assigned once
Ah thanks John that makes sense,
I will try and add a tax_query into the query and switch taxonomy/term value to belong to a field in the field group.
FYI – The first section of your code in that posts caused a syntax error, heres the adjusted code that resovles the error.
add_filter('acf/load_field/name=hidden_post_id', 'make_hidden_post_id_readonly');
function make_field_readonly($field) {
// sets readonly attribute for field
$field['readonly'] = 1;
return field;
}
add_filter('acf/load_value/name=hidden_post_id', 'set_hidden_post_id_value', 10, 3);
function set_hidden_post_id_value($value, $post_id, $field) {
// set the value of the field to the current post id
return $post_id;
}
Working through your steps now hopefully I’ll have this working soon 🙂
Thanks again!
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.