Obfuscate email addresses to deter email-harvesting spammers, with a focus on retaining the appearance and functionality of email hyperlinks.
“Obfuscation” simply means that techniques are employed to modify email address strings that appear on your site in such a way that bots scraping your site are unable to identify those addresses; however, at the same time those emails addresses should still look and work correctly for visitors, as much as possible.
The plugin allows for use of one or more (or all!) of three techniques for email protection that have proven themselves in the past. While techniques abound for email obfuscation, the three techniques included provide the best balance of email address protection with minimal impact on visitors. You can decide on a technique by technique basis which ones you’d like to employ as some have potential drawbacks. The plugin’s settings page allows you select which techniques to use.
Ultimately, your best bet would be to not publicly expose an email address and to offer a contact form as an alternative means of contact. Or you can just accept that email addresses will get scraped and spammed, and rely on an email service that is good at filtering out spam. But this plugin is here for you if you want to employ the most reasonable means of making email harvesting difficult for your site.
See Filters section for c2c_obfuscate_email_filters for complete list of filters that are processed.
Please read the Details section of this documentation to learn more about the techniques employed.
The email obfuscation techniques included in this plugin were chosen for their effectiveness and general applicability with minimal impact on users. I urge you to read about an experiment performed by Silvan Mühlemann in which he protected email addresses using nine different techniques. He ensured the page containing those email addresses got indexed by Google and then waited 1.5 years. During that time he measured the amount of spam received to each of the email addresses. (Note: this experiment came out a few years after this plugin was originally created, but at this point was conducted over 10 years ago. Its conclusions may not apply as strongly today.)
Three techniques stood out as having received zero spam emails during that time. Two of those three techniques are included in this plugin. The fourth of his techniques is also included even though it did get a very small amount of spam — the technique was still very effective and more importantly does not rely on users to have CSS or JavaScript enabled.
The techniques are as follows. Two are enabled by default. Weigh the requirements against what you’re comfortable requiring of visitors in order for them to see and make use of email addresses you post on your site.
(For all the examples below, assume you have the link <a href="mailto:[email protected]">[email protected]</a> in your post.)
How does it work? Garbage text, wrapped in span tags, is inserted into any displayed email addresses. Using CSS, the text gets hidden so that visitors see the email addresses as intended. Email scrapers don’t typically utilize a CSS engine to help determine how text would look onscreen.
Uses CSS? Yes, which means if a visitor does not have CSS enabled, the emails will appear with extra text in them.
Uses JavasScript? No.
Can visitor copy-n-paste the link from onscreen text without needing to make modifications? Yes (unless they have CSS disabled).
Does this protect email addresses appearing in mailto: links and within HTML tag attributes? No.
How effective is this? In the aforementioned experiment, no spam emails were received when using just this technique.
Example
<a href="mailto:[email protected]">person@<span class="displaynone">null</span>example.com</a>
How does it work? The @ and . characters are replaced with alternative strings, such as AT and DOT, respectively. The exact replacements are configurable on the plugin’s settings page. By default, if you don’t specify custom replacements, the plugin will use entity substitution (@ becomes @ and . becomes .).
Uses CSS? No.
Uses JavasScript? No.
Can visitor copy-n-paste the link from onscreen text without needing to make modifications? No, though it should (hopefully) be clear to the user what they need to replace.
Does this protect emails appearing in mailto: links and within HTML tag attributes? Yes, though if you specify custom replacement strings visitors clicking on a mailto link will have to modify the email address that shows up in their mail program.
How effective is this? In the aforementioned experiment, almost no spam emails were received when using just this technique. As a bonus, this technique does not require the support of any particular client-side techniques (CSS or JavaScript).
Examples
How does it work? The email addresses are sent reversed in the markup. Using CSS, the text gets reversed so that visitors see the email addresses as intended. Email scrapers don’t recognize the emails in their reversed form and don’t typically utilize a CSS engine to help determine how text would look onscreen.
Uses CSS? Yes, which means if a visitor does not have CSS enabled, the emails will appear backwards to them.
Uses JavasScript? No.
Can visitor copy-n-paste the link from onscreen text without needing to make modifications? No, text copied in such a manner will be reversed. However, a right-click -> “copy link/email address” will work properly for linked email addresses.
Does this protect emails appearing in mailto: links and within HTML tag attributes? No.
How effective is this? In the aforementioned experiment, no spam emails were received when using just this technique.
Example:
<a href="mailto:[email protected]"><span class="codedirection">moc.elpmaxe@nosrep</span></a>
If all techniques are enabled at once, the resulting obfuscation of the example link above is (for the full effect, view this in the page’s source or the readme.txt file directly):
<a href="mailto:[email protected]"><span class="codedirection">moc.elpmaxe<span class="displaynone">null</span>@nosrep</span></a>
However, in your browser it would appear to you as it does prior to obfuscation, and the link for the email would still work. Theoretically, however, spammers would have a somewhat more difficult time harvesting the emails you display or link to in your posts.
NOTE: (Only when using the custom replacement feature will visitors need to modify the email address for use in their email program.)
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
The plugin provides one optional template tag for use in your theme templates.
$text
Required argument. The text and/or HTML that contains email addresses that you want to be obfuscated.
$args
Optional argument. An array of configuration options, each element of which will override the plugin’s corresponding default setting.
Basic usage. Obfuscate email addresses in $text according to current plugin settings.
Override all plugin default settings when obfuscating email addresses in $text and just use text direction technique.
true, ‘use_display_none’ => false, ‘encode_everything’ => false, ‘at_replace’ => ”, ‘dot_replace’ => ”)
) ); ?>
The plugin exposes one filter for hooking. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).
c2c_obfuscate_email_filters (filter)
The ‘c2c_obfuscate_email_filters’ filter allows you to customize what filters get processed for email obfuscation. The following filters are all filtered by default:
Arguments:
Example:
/** * Also obfuscate emails appearing in custom field values. * * @param array $filters Filters that get filtered to obfuscate email addresses. * @return array */ function change_c2c_obfuscate_email_filters( $filters ) { $filters[] = 'the_meta'; return $filters; } add_filter( 'c2c_obfuscate_email_filters', 'change_c2c_obfuscate_email_filters' );
Starting from $0 per month.
Rating
Reviewers
13 reviews
Tags
Developed By
Scott Reilly
Quick & Easy
Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!
Testimonial plugins for Wordpress
Galleries plugins for Wordpress
SEO plugins for Wordpress
Contact Form plugins for Wordpress
Forms plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Comments plugins for Wordpress
Portfolio plugins for Wordpress
Maps plugins for Wordpress
Security plugins for Wordpress
Translation plugins for Wordpress
Ads plugins for Wordpress
Video Player plugins for Wordpress
Music Player plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Chat plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Tabs plugins for Wordpress
Membership plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Inventory plugins for Wordpress
Video Player plugins for Wordpress
Testimonials plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Social Feeds plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Events Calendar plugins for Wordpress
Contact plugins for Wordpress
Comments plugins for Wordpress
Analytics plugins for Wordpress
Common Ninja Apps
Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.
Create Impressive YouTube Feeds & Improve User Experience
Add Audio Player to Enrich & Promote Your Website Content
Boost Credibility, Improve SEO & Increase Conversions
Keep Clients Informed & Boost Conversions With the Updates & Announcements Widget
Increase Engagement with Social Sharing
Showcase and Manage Business Listings Effortlessly
Dynamic pricing displays for enhanced user interactions
Bring Focus to Team Members in a Creative Way To Increase Trust
Empower Users to Suggest and Vote on Features
Build Fun and Custom Leaderboards to Boost Competition
Create Stunning Blogger Feeds & Improve User Experience
Boost Your Site's Trust and Engagement with Social Proof
More plugins
The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!