I’ve been looking into Email Obfuscation and trying to get away from obfuscation plugins when I ran across this code snippet[1]:

function remove_plaintext_email($emailAddress) {
    $emailRegEx = '/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4})/i';
    return preg_replace_callback($emailRegEx, "encodeEmail", $emailAddress);
function encodeEmail($result) {
    return antispambot($result[1]);
add_filter( 'the_content', 'remove_plaintext_email', 20 );
add_filter( 'widget_text', 'remove_plaintext_email', 20 );

For me, this pretty much replaces any obfuscation plugin out there in a few lines of code which is always good. My concern is the way antispambot() tries to hide the email via converting it to HTML Entities. My question is, is that enough to stop spambots from grabbing the email? This function has been around for so long I just wanted to make sure it was still valid to use or if there was a better way to hide emails from spambots.

[1] Source

Read more here: Email Obfuscation: Is antispambot() Acceptable?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: