Home › Forums › ACF PRO › Get Post ID of post where acf_form is embedded within acf/validate_value › Reply To: Get Post ID of post where acf_form is embedded within acf/validate_value
Well, I tried one more thing literally a few seconds after posting my previous thread and managed to figure it out 🙂
Hope the following helps someone; the trick seems to be $_POST['post_id']
.
function my_validate_value( $valid, $value, $field, $input ) {
$post_id = $_POST['post_id'];
if($value !== 'my-condition'){
$valid = 'Nope: ' . $post_id;
};
return $valid;
}
add_filter('acf/validate_value/key=field_5928960704f6f', 'my_validate_value', 10, 4);
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.