Viewing 1 replies (of 1 total)
  • Thread Starter Stagger Lee

    (@stagger-lee)

    This seems to work, no shortcode around e-mail address needed.

    /**
     * Hide email from Spam Bots using a shortcode.
     *
     * @param array  $atts    Shortcode attributes. Not used.
     * @param string $content The shortcode content. Should be an email address.
     *
     * @return string The obfuscated email address.
     */
    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' );
Viewing 1 replies (of 1 total)
  • The topic ‘Email ID – Spammers’ is closed to new replies.