1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function wpm_password_validation_filter( $result, $tag ) { $tag = new WPCF7_Shortcode( $tag ); if ( 'PASSWORD-CONFIRM' == $tag->name ) { $your_password = isset( $_POST['PASSWORD'] ) ? trim( $_POST['PASSWORD'] ) : ''; $your_password_confirm = isset( $_POST['PASSWORD-CONFIRM'] ) ? trim( $_POST['PASSWORD-CONFIRM'] ) : ''; if ( $your_password != $your_password_confirm ) { $result->invalidate( $tag, "Are you sure this is the correct password?" ); } } return $result; } add_filter( 'wpcf7_validate_text*', 'wpm_password_validation_filter', 20, 2 ); |