{"id":133010,"date":"2014-10-12T08:00:22","date_gmt":"2014-10-12T12:00:22","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=133010"},"modified":"2014-10-10T02:25:27","modified_gmt":"2014-10-10T06:25:27","slug":"how-to-protect-email-addresses-on-your-wordpress-site","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/how-to-protect-email-addresses-on-your-wordpress-site\/","title":{"rendered":"How To Protect Email Addresses On Your WordPress Site"},"content":{"rendered":"<p>It may be old and and it&#8217;s definitely uncool but email is still a significant communication channel and that means it still garners the attention of the spammers.<\/p>\n<p>The first step in email anti-spam is not to handover the email address but often there&#8217;s a requirement, especially for organizations, to publish an email address on their WordPress site.<\/p>\n<p>In this Weekend WordPress Project, we&#8217;ll look at how to\u00a0make the scraping of email addresses from your site as difficult as possible.<\/p>\n<p><!--more--><\/p>\n<figure id=\"attachment_133026\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-large wp-image-133026\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2014\/10\/wwp_email_encode-700x218.jpg\" alt=\"Email encoding is quick, easy and effective\" width=\"700\" height=\"218\" \/><figcaption class=\"wp-caption-text\">Email encoding is quick, easy and effective<\/figcaption><\/figure>\n<p>Before we start, it&#8217;s important to appreciate that there is no failsafe method of protecting an email address or indeed any content.\u00a0What we are trying to do here is raise the degree of difficulty just enough to foil the majority of bots.<\/p>\n<p>The other key consideration is that the horse has probably already bolted for\u00a0any email addresses that have been on your site for any length of time. That said, adding the protecting to your website will not do any harm.<\/p>\n<p>So, how do you deter the majority of bots?<\/p>\n<p>The bots work by scanning the source code of your site, looking for email addresses and following links to other pages. Email addresses are fairly easy to pick out due to their formatting and their use of the &#8220;mailto&#8221; URL scheme.<\/p>\n<p>There are various techniques for making harvesting of these links difficult but the most successful and the most usability-friendly approach is to\u00a0encode the email address.<\/p>\n<p>Whilst browsers will decode the address and it will display and behave exactly as normal, most bots don&#8217;t decode nor do search for an encoded @ &#8211; they don&#8217;t have to as there are enough websites that publish email addresses in plain text.<\/p>\n<h2>Installing The Email Address Encoder Plugin<\/h2>\n<figure id=\"attachment_133020\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-133020\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2014\/10\/email_encoder.jpg\" alt=\"Email Address Encoder promo image\" width=\"700\" height=\"228\" \/><figcaption class=\"wp-caption-text\">Simple email address obfuscation that won&#8217;t impact on usability<\/figcaption><\/figure>\n<p>All that&#8217;s required to encode\u00a0the email addresses is to install the <a title=\"Read more about this plugin in the WordPress plugin repository\" href=\"https:\/\/wordpress.org\/plugins\/email-address-encoder\/\" rel=\"noopener\" target=\"_blank\">Email Address Encoder plugin<\/a>, one of the best documented plugins, incidentally, in the WordPress plugin repository.<\/p>\n<p>The plugin uses a variety of filters to encode email addresses on the fly as WordPress puts a page together including those found in posts, pages, widgets, comments and excerpts.<\/p>\n<p>So, for example,\u00a0whilst the browser shows this:<\/p>\n<figure id=\"attachment_133021\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-133021\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2014\/10\/email_encoder_human.png\" alt=\"Screenshot of two email address that appear normal despite being encoded\" width=\"700\" height=\"281\" \/><figcaption class=\"wp-caption-text\">For humans, everything looks like normal<\/figcaption><\/figure>\n<p>What the bot sees is very different:<\/p>\n<div class=\"gist\" data-gist=\"6fee693b5c75f733de8f\" data-gist-file=\"email_encoder.html\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/6fee693b5c75f733de8f.js?file=email_encoder.html\">Loading gist 6fee693b5c75f733de8f<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div>\n<p>Notice also how the email address in the content itself has also been encoded.<\/p>\n<p>This technique won&#8217;t guarantee that email addresses on your site won&#8217;t get scraped but it will certainly prevent most of the scraper bots from plying their trade whilst maintaining usability.<\/p>\n<p>Well worth the five minutes to install the plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your WordPress is still being scraped for email addresses. In this Weekend WordPress Project we&#8217;ll look at how to make such harvesting too difficult for the average spam bot.<\/p>\n","protected":false},"author":262394,"featured_media":133026,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263,11260],"tags":[106,20,9798],"tutorials_categories":[],"class_list":["post-133010","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-wpmu-dev-products","tag-email","tag-spam","tag-weekend-wordpress-projects"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/133010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/262394"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=133010"}],"version-history":[{"count":2,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/133010\/revisions"}],"predecessor-version":[{"id":218969,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/133010\/revisions\/218969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/133026"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=133010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=133010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=133010"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=133010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}