acf_form_widget::acf_validate_save_post
acf_validate_save_post
This function will loop over $_POST data and validate
Method of the class: acf_form_widget{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_form_widget = new acf_form_widget(); $acf_form_widget->acf_validate_save_post();
Changelog
| Since 5.4.0 | Introduced. |
acf_form_widget::acf_validate_save_post() acf form widget::acf validate save post code ACF 6.0.4
function acf_validate_save_post() {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
// bail early if not widget
if ( ! isset( $_POST['_acf_widget_id'] ) ) {
return;
}
// vars
$id = sanitize_text_field( $_POST['_acf_widget_id'] );
$number = sanitize_text_field( $_POST['_acf_widget_number'] );
$prefix = sanitize_text_field( $_POST['_acf_widget_prefix'] );
$values = acf_sanitize_request_args( $_POST[ $id ][ $number ]['acf'] );
// validate
acf_validate_values( $values, $prefix );
// phpcs:enable WordPress.Security.NonceVerification.Missing
}