Title: custom link shortcode not working
Last modified: June 25, 2021

---

# custom link shortcode not working

 *  Resolved [dzseti](https://wordpress.org/support/users/dzseti/)
 * (@dzseti)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-link-shortcode-not-working/)
 * As per [this article](https://kb.mailpoet.com/article/160-create-a-custom-shortcode)
   I have set up a custom link as indicated:
 *     ```
       function mailpoet_custom_shortcode_referral_link($shortcode, $newsletter, $subscriber, $queue, $arguments) {
         // always return the shortcode if it doesn't match your own!
         if ($shortcode !== '[link:cj]') return $shortcode;
   
         $referral_link = get_page_link(get_page_by_title('curated journeys live feed')->ID) . '?email=xxxx';
   
         return $referral_link;
       }
       ```
   
 * On a test page the set value
 * > get_page_link(get_page_by_title(‘curated journeys live feed’)->ID) . ‘?email
   > =xxxx’
 *  is correct. It shows the value
 * > [https://example.com/6ge628fd7e/?email=xxxx](https://example.com/6ge628fd7e/?email=xxxx)
 * But the email itself includes a link like this:
 * > [https://example.com/?mailpoet_router&endpoint=track&action=click&data=WzI2LCIyNzVjYzciLCI0IiwiM2RkMjNiNGQ1ODg0IixmYWxzZV0](https://example.com/?mailpoet_router&endpoint=track&action=click&data=WzI2LCIyNzVjYzciLCI0IiwiM2RkMjNiNGQ1ODg0IixmYWxzZV0)
 * ie there are two problems:
 * (1) the part of the url after the domain name
 * > 6ge628fd7e/
 *  has been dropped
    (2) the get data
 * > ?email=xxxx
 *  has been replaced by tracking data
 * What am I doing wrong?
    -  This topic was modified 4 years, 9 months ago by [dzseti](https://wordpress.org/support/users/dzseti/).
    -  This topic was modified 4 years, 9 months ago by [dzseti](https://wordpress.org/support/users/dzseti/).
    -  This topic was modified 4 years, 9 months ago by [dzseti](https://wordpress.org/support/users/dzseti/).

Viewing 1 replies (of 1 total)

 *  [dromero20](https://wordpress.org/support/users/dromero20/)
 * (@dromero20)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-link-shortcode-not-working/#post-14603126)
 * Duplicated.
 * Replied here: [https://wordpress.org/support/topic/custom-link-shortcode-in-theme-functions-php-file-not-working/#post-14603123](https://wordpress.org/support/topic/custom-link-shortcode-in-theme-functions-php-file-not-working/#post-14603123)

Viewing 1 replies (of 1 total)

The topic ‘custom link shortcode not working’ is closed to new replies.

 * ![](https://ps.w.org/mailpoet/assets/icon-256x256.png?rev=3284564)
 * [MailPoet - Newsletters, Email Marketing, and Automation](https://wordpress.org/plugins/mailpoet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailpoet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailpoet/)
 * [Active Topics](https://wordpress.org/support/plugin/mailpoet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailpoet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailpoet/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [dromero20](https://wordpress.org/support/users/dromero20/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/custom-link-shortcode-not-working/#post-14603126)
 * Status: resolved