I’m trying to use acf_add_validation_error
, but it doesn’t show the error for the input. Does anyone know how to make this work properly?
Here is my example:
acf_add_validation_error( 'first_name', 'Required' );
acf_add_validation_error()
is not a documented ACF function.
This is the ACF documentation for adding validation to fields https://www.advancedcustomfields.com/resources/acf-validate_value/
For future reference, this function is referred to here: https://www.advancedcustomfields.com/resources/acf-validate_save_post/
It will work if you use the selector within the input name. Should be something such as acf[field_5b1e124565677].
acf_add_validation_error( 'acf[field_5b1e124565677]', 'Required' );
Thanks @sloconte, after all this time I can still learn something new.
Thanks @sloconte. Just what I was looking for…