I want to validate a post before to submit.
Is there any differences?
add_action('acf/validate_save_post', 'my_acf_validate_save_post');
function my_acf_validate_save_post() {
// Do validate.
}
I want to validate a post before to submit.
Is there any differences?
add_action('acf/validate_save_post', 'my_acf_validate_save_post');
function my_acf_validate_save_post() {
// Do validate.
}
Both actions are ajaxed before submit.
$_POST.acf_add_validation_error. You must know html input name of ACF field. eg) acf_add_validation_error( 'acf[field_628ca71315e3d]', 'Please check this input to proceed' );get_fields( $post_id ). eg) [ 'price' => 1000 ]$_POST with a part of html input names. eg) [ 'field_628ca71315e3d' => 2000 ]