Skip to content

Instantly share code, notes, and snippets.

@webdevs-pro
Created December 5, 2019 12:08
Show Gist options
  • Save webdevs-pro/48fd663d7409dd1b4fcbabbba97d32e5 to your computer and use it in GitHub Desktop.
Save webdevs-pro/48fd663d7409dd1b4fcbabbba97d32e5 to your computer and use it in GitHub Desktop.
ACF confirm password validation
<?php
add_filter('acf/validate_value/name=user_password_confirm', 'my_validated_password_filter', 10, 4);
function my_validated_password_filter($valid, $value, $field, $input) {
if (!$valid) {
return $valid;
}
// field key of the field you want to validate against
$password_field = 'field_5de8dff728aa2';
if ($value != $_POST['acf'][$password_field]) {
$valid = 'Does Not Match Password';
}
return $valid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment