acf_form_front::validate_save_post()publicACF 5.4.0

validate_save_post

This function will validate fields from the above array

Метод класса: acf_form_front{}

Хуков нет.

Возвращает

$post_id. (int)

Использование

$acf_form_front = new acf_form_front();
$acf_form_front->validate_save_post();

Список изменений

С версии 5.4.0 Введена.

Код acf_form_front::validate_save_post() ACF 6.0.4

function validate_save_post() {

	// register field if isset in $_POST
	foreach ( $this->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' ) );

	}

}