Apostrophes or Single Quote support in user registration email address
-
For a user email field, if the email address contain apostrophes or single quote (example abc’[email protected]), then you will get error per below while submit the form.
ERROR: The email address isn’t correct.
This is due to formatting.php is_email() validation checking not allow the email address with single quote ‘ to pass through when do email address checking. I am using wordpress version 3.0.5
After some digging, I manage to make it work, and to share the workaround.
1. Go to your wordpress folder and open file \wordpress\wp-includes\formatting.php
2. Search for is_email keyword, or faster way search for “function is_email” without the quote.
3. Look at comment // LOCAL PART Test for invalid characters. Example of the code per below:// LOCAL PART // Test for invalid characters if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_
{|}~\.-]+$/’, $local ) ) {
return apply_filters( ‘is_email’, false, $email, ‘local_invalid_chars’ );
}`4. Copy paste code below to replace above piece of code:
// LOCAL PART // Test for invalid characters if ( preg_match( '/[!#$%&*+\/=?^
{|}~]/’, $local ) ) {
return apply_filters( ‘is_email’, false, $email, ‘local_invalid_chars’ );
}`5. Basically it change the way the regular expression work to check for invalid character. Save the file and it should be working fine with user email address with ‘.
If any problem, please do help me to fix ya.. ??
If the solution work, do let me know too…. I not done through intensive testing, so take your own risk.
- The topic ‘Apostrophes or Single Quote support in user registration email address’ is closed to new replies.