is_email
is a native WP function. As you can see here (https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-includes/formatting.php#L2886) it allows you to modify it with filter is_email
.
So yes – anytime the function is_email
will be called, it will run, and at the end it will run your filters allowing you to modify the result.
But… The filter should take 3 params:
$is_email (bool) Whether the email address has passed the is_email()
checks. Default false.$email (string) The email address being checked.
$context (string) Context under which the email was tested.
function my_email_validation( $is_email, $email, $context )
{
if ( <MY CONDITION> ) { // check if it is an email
return true;
}
return false;
}
add_filter( 'is_email', 'my_email_validation', 99, 3 );
So your code doesn’t work, because you use this filter incorrectly (you register it as it should take 4 params and your filter function takes only one, and so on).