• Skip to main content
  • Skip to primary sidebar

Supplemental Resources

Just The Tech, News, and Info We Deem To Post

  • Home
  • Home
  • Home
  • Home
  • Home
  • Home
  • Home
  • Home
  • Home
  • About
  • About
  • About
  • About
  • About
  • About
  • About
  • About
  • About
  • Contact
  • Contact
  • Contact
  • Contact
  • Contact
  • Contact
  • Contact
  • Contact
  • Contact
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • Contribute
  • WordPress
  • Marketing
  • Business
  • Computing
  • Security
  • Publicity
  • Resources
  • WHATEVS

WordPress Email Spambot Shortcode

Screenshot of WordPress plugin php and html code

The WordPress Email Spambot Short Code encodes email address when placed inside the short code.

Usage Example:

[email]myemail@mydomain.com[/email]

Code to hide email addresses from spambots:

/** HIDE EMAIL FROM SPAM BOTS USING A SHORTCODE. */
function wpcodex_hide_email_shortcode( $atts , $content = null ) {
 if ( ! is_email( $content ) ) {
 return;
 }

 return '<a href="mailto:' . antispambot( $content ) . '">' . antispambot( $content ) . '</a>';
}
add_shortcode( 'email', 'wpcodex_hide_email_shortcode' );
add_filter( 'widget_text', 'shortcode_unautop' );
add_filter( 'widget_text', 'do_shortcode' );

by Jack Alltrade on January 13, 2022

Filed Under: Code Snippets

Reader Interactions

Share Your Two Cents Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

© Copyright Jack Alltrade & Associates 2026 · Purely Supplemental™ is a trademark of Jack Alltrade & Associates