Created
December 5, 2019 12:08
-
-
Save webdevs-pro/48fd663d7409dd1b4fcbabbba97d32e5 to your computer and use it in GitHub Desktop.
ACF confirm password validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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