Title: Does not encode link with custom text
Last modified: August 20, 2016

---

# Does not encode link with custom text

 *  Resolved [Matthias](https://wordpress.org/support/users/digitalcult/)
 * (@digitalcult)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/)
 * I’m not sure whether I misconfigured something in my template or if the plugin
   really doesn’t encode the mailto-link when text (other than the mail address)
   is linked.
 * e.g.
    `Or you can <a title="Send email to xyz" href="mailto:you@yourdomain.com"
   >send us an email</a>.`
 * It works fine when an email address is written in the text.
    Anyone else having
   the same issue?
 * Cheers,
    Matthias
 * [http://wordpress.org/extend/plugins/email-address-encoder/](http://wordpress.org/extend/plugins/email-address-encoder/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370597)
 * If your content isn’t passed through the `the_content` filter (or a few others),
   then you’ll need to encode it manually in your template files.
 * Where is that snippet above coming from, the WordPress editor, or from a template
   file?
 *  Thread Starter [Matthias](https://wordpress.org/support/users/digitalcult/)
 * (@digitalcult)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370634)
 * Hmm.. found why it doesn’t work: The snippet above is written in the WordPress
   Editor and is placed on a (static) content page. Somewhere before that part there
   is a shortcode that shows posts from a certain category (announcements), which
   should be displayed as normal content in between two other text blocks (written
   in the editor).
 * When I remove the shortcode above that said text part, the plugin works fine 
   and the email link is encoded.
 * This is the part where the shortcode gets the posts:
 *     ```
       $return_string = '';
       query_posts(array('orderby' => $order_by, 'order' => $order, 'cat' => $category_id , 'category_name' => $category_name , 'showposts' => $posts));
       if (have_posts()) :
           while (have_posts()) : the_post();
               $content = get_the_content();
               $content = apply_filters('the_content', $content);
               $content = str_replace(']]>', ']]>', $content);
   
               $return_string .= '<div class="listed-post">';
               $return_string .= '<h2>'. get_the_title() .'</h2>';
               $return_string .= $content;
               $return_string .= '</div>';
           endwhile;
       endif;
   
       wp_reset_query();
       return $return_string;
       ```
   
 * Any ideas how I could fix that?
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370636)
 * I’m not sure if I understand your setup fully. Could you post the code where 
   the mailto-link is printed?
 *  Thread Starter [Matthias](https://wordpress.org/support/users/digitalcult/)
 * (@digitalcult)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370637)
 * Do you mean the html output or the page.php (and the shortcodes.php)?
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370638)
 * Your “page.php”, and please use something like pastebin.com.
 *  Thread Starter [Matthias](https://wordpress.org/support/users/digitalcult/)
 * (@digitalcult)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370639)
 * On the page there is a lot of static content/text. And in between two of the 
   text blocks, there should be all the posts of a given category. I thought the
   simplest way to do this is a shortcode that displays those posts.
 * page.php
    [http://pastebin.com/GHAgeDcc](http://pastebin.com/GHAgeDcc)
 * content-page.php
    [http://pastebin.com/rJRxkJxp](http://pastebin.com/rJRxkJxp)
 * shortcodes.php (the used snippet for the post listing)
    [http://pastebin.com/RBG36dSK](http://pastebin.com/RBG36dSK)
 * …sorry for the troubles.
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370642)
 * Looks good. Where exactly is the mailto-link printed that doesn’t get encoded?`
   aaa_show_posts()`?
 * Could you check the result of the page without using Firebug, Web Inspector or
   Dragonfly, because they decode decimal/hexadecimal entities into plain text. 
   To make sure your email address is encoded, right-click/secondary-click the page,
   click “View Source”, “View Page Source” or “Source” and search for the plain 
   text email address.
 *  Thread Starter [Matthias](https://wordpress.org/support/users/digitalcult/)
 * (@digitalcult)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370643)
 * No, it’s somewhere underneath the part with the aaa_show_posts() shortcode.
 * I checked the source code. When the shortcode is not placed on the page, everything
   is fine (read: your plugin works like a charm). But as soon as I put this shortcode
   somewhere on the page (doesn’t matter if it’s above or underneath the email link),
   the mail link isn’t encoded anymore.
 * Guess I have to re-write my shortcode somehow…
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370644)
 * Could you [drop me a line](http://tillkruess.com/contact/)?

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Does not encode link with custom text’ is closed to new replies.

 * ![](https://ps.w.org/email-address-encoder/assets/icon-256x256.jpg?rev=970206)
 * [Email Address Encoder](https://wordpress.org/plugins/email-address-encoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-address-encoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-address-encoder/)
 * [Active Topics](https://wordpress.org/support/plugin/email-address-encoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-address-encoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-address-encoder/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/does-not-encode-link-with-custom-text/#post-3370644)
 * Status: resolved