How to add filter to __() and _e()?

I would wish to add a filter to _e() and __() functions. The filter is FilterTextOfEmail(). This will basically detect any emails and add anti-spam method to it.

I assume, the function for filtering should look like:

Read More
function my_wp_text_email_filtering ($content) {
    return FilterTextOfEmail($content)
}

But how to call it?

Related posts

Leave a Reply

2 comments

  1. The filter name is gettext, and you would add it like this:

    add_filter( 'gettext', 'my_wp_text_email_filtering', 10, 3 );
    
    function my_wp_text_email_filtering( $translated, $text, $domain ) {
        return FilterTextOfEmail( $translated );
    }
    

    The $text argument is there also in case you want to access the pre-translated text.