the value of the checkbox wouldn’t be “checked” – it should equal whatever you put in the “value” attribute .. and i think you need an extra set of parentheses in the if statement for first_name
to make sure your filter is firing you could try explicitly adding an error (with no validation checks) to see if you can force registration to fail
//2. Add validation. In this case, we make sure first_name is required.
add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 );
function myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) {
if ( empty( $_POST['first_name'] ) || ( ! empty( $_POST['first_name'] ) && trim( $_POST['first_name'] ) == '' ) ) {
$errors->add( 'first_name_error', __( '<strong>CHYBA</strong>: Musíte uvést své jméno a příjmení.', 'faveaplus' ) );
}
if ( empty($_POST['subscribe']) ) {
$errors->add( 'subscribe_error', __( '<strong>CHYBA</strong>: Musíte prohlásit, že jste pracovník ve zdravotnictví', 'faveaplus' ) );
}
return $errors;
}