Git Product home page Git Product logo

email-obfuscator-wordpress's Introduction

PHP Email Obfuscator for WordPress

This GitHub repository contains PHP code which obfuscates all email addresses present in your WordPress site's content and theme files. It employs output buffering and regex pattern matching to replace all instances of mailto links with their obfuscated versions, thereby providing an effective measure against email harvesting spam bots.

Description

The code initiates an output buffer before the page starts rendering, using a callback function that will modify the buffer's contents. At the end of page rendering, it applies the callback function to the buffer's contents, effectively obfuscating all mailto email addresses found in the buffer.

The email obfuscation is achieved using WordPress's antispambot function, which is a popular mechanism for deterring spam bots from harvesting email addresses.

How to Use

To use this code in your WordPress theme:

  1. Copy and paste the code into your theme's functions.php file or a suitable custom plugin file.
  2. The code will automatically hook into the get_header and wp_footer actions, ensuring that the entire content of your website is passed through the obfuscation process.

Key Features

  • Uses WordPress's built-in antispambot function for email obfuscation.
  • Utilizes PHP output buffering and callback mechanism to process entire page content.
  • Hooks into WordPress actions for seamless integration with theme files.
  • Adds an effective layer of protection against email harvesting spam bots.

SEO Focus

  • Prevents email harvesting, reducing spam, enhancing user trust, and potentially improving SEO performance.
  • No impact on site speed or user experience, ensuring optimal SEO rankings.
  • Fully compatible with WordPress, the world's leading content management system.

Please remember to replace [email protected] with the actual email address you wish to obfuscate.

Keywords

  • WordPress
  • PHP
  • Email Obfuscation
  • Antispambot
  • Spam Protection
  • Email Harvesting
  • Output Buffering
  • Regular Expression
  • Functions.php
  • Mailto Links

Changelog

Version 1.0.0 Date: 2024-05-08 Works with currenr WP Version

  • Added obfuscate_mailto_links function to obfuscate all email addresses in mailto links across the site.
  • The function applies to content in posts, pages, widgets, excerpts, and comments.
  • Uses WordPress's antispambot() function to convert email addresses into HTML entities, preventing email harvesting by bots.
  • Filters applied: the_content, widget_text, the_excerpt, and comment_text to cover a wide range of outputs.

email-obfuscator-wordpress's People

Contributors

artsunique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.