Support

Account

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);