Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created May 15, 2011 02:23
Show Gist options
  • Save thefuxia/972837 to your computer and use it in GitHub Desktop.
Save thefuxia/972837 to your computer and use it in GitHub Desktop.
T5 Extend Email Checks
<?php # -*- coding: utf-8 -*-
/*
Plugin Name: T5 Extend Email Checks
Description: Overrides the results of the functions <code>is_email()</code> and <code>sanitize_email()</code>. Allows for example <code>me@localhost</code> or punycode encoded email adresses by using PHP’s internal filter function.
Version: 2012.08.29
Plugin URI: http://toscho.de/?p=2195
Author: Thomas Scholz
Author URI: http://toscho.de
License: MIT
*/
! defined( 'ABSPATH' ) and exit;
if ( ! function_exists( 't5_extend_email_checks' ) )
{
add_filter( 'is_email', 'extend_email_checks', 10, 2 );
add_filter( 'sanitize_email', 'extend_email_checks', 10, 2 );
function t5_extend_email_checks( $result, $email )
{
return filter_var( $email, FILTER_VALIDATE_EMAIL );
}
}
@swinhoe
Copy link

swinhoe commented Sep 16, 2011

They, dont, its a logged issue in WP Trac. Im trying to find the easiest workaround...

@swinhoe
Copy link

swinhoe commented Apr 23, 2012

Are we going to get this change pushed into a future release ?

https://wordpress.org/support/topic/writing-a-plugin-to-amend-the-core-possible?replies=9#post-2769861

It would be handy to support email address's properly...

@thefuxia
Copy link
Author

There is an open ticket: http://core.trac.wordpress.org/ticket/17433

Go, vote for it, add Unit tests. Then it may become part of the core.

@swinhoe
Copy link

swinhoe commented Apr 23, 2012 via email

@thefuxia
Copy link
Author

Ask on Trac. I have no influence to core development.

@tcbarrett
Copy link

The callback functions need the t5_ prefix - have forked a working example.

Note that apostrophes are escaped by WordPress, so they are still invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment