acf_form_front::validate_save_post
This function will validate fields from the above array
Method of the class: acf_form_front{}
No Hooks.
Returns
$post_id. (int)
Usage
$acf_form_front = new acf_form_front(); $acf_form_front->validate_save_post();
Changelog
| Since 5.4.0 | Introduced. |
acf_form_front::validate_save_post() acf form front::validate save post code ACF 6.8.8
function validate_save_post() {
// register field if isset in $_POST
foreach ( $this->get_default_fields() as $k => $field ) {
// bail early if no in $_POST
if ( ! isset( $_POST['acf'][ $k ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
continue;
}
// register
acf_add_local_field( $field );
}
// honeypot
if ( ! empty( $_POST['acf']['_validate_email'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Data not used; presence indicates spam.
acf_add_validation_error( '', __( 'Spam Detected', 'acf' ) );
}
}