Strips out all characters that are not allowable in an email address.
After sanitize_email()
has done its work, it passes the sanitized e-mail address through the sanitize_email filter.
<?php sanitize_email( $email ) ?>
<?php $sanitized_email = sanitize_email(' admin@example.com! '); echo $sanitized_email; // will output: 'admin@example.com' ?>
/[^a-z0-9+_.@-]/i
.Since: 1.5.0
sanitize_email()
is located in wp-includes/formatting.php
.
sanitize_email()
is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type. Others include: