WordPress comment author required

im trying to make wordpress comment author required, im following the wordpress developer guide but it appears the preprocess_comment hook isnt fired for some reason, ive researched for solutions myself and im not the only one with this problem.

I dont wanna check, the checkbox from the panel, because i dont wanna store any email adress on the database. And I dont want to make the trick of hidding the email input with a default value. And I dont wanna make javascript validation.

I need the wordpress hook work straight because I may need it for other situations. Any ideas? Thanks.

function require_comment_name($fields) {
    if ($fields['comment_author'] == '')
    wp_die('Error: please enter a valid name.');
     
    return $fields;
}
add_filter('preprocess_comment', 'require_comment_name');

https://www.howtosolutions.net/2015/10/wordpress-comments-making-email-field-optional/

https://developer.wordpress.org/reference/hooks/preprocess_comment/#comment-4773

WordPress preprocess_comment hook not firing

Source: Ask PHP

LEAVE A COMMENT