Title: Custom Shortcode Issue &#8211; It Doesn&#8217;t Show Properly
Last modified: January 9, 2025

---

# Custom Shortcode Issue – It Doesn’t Show Properly

 *  Resolved [sibivfl](https://wordpress.org/support/users/sibivfl/)
 * (@sibivfl)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/custom-shortcode-issue-it-doesnt-show-properly/)
 * I am trying to get a custom shortcode working to my Completed Order template,
   but whatever I do, it doesn’t work.
 * Basically I want to be able to add a custom URL to the Completed Order message
   when changing a status of the order.
 * In email message I am getting this
 * [canva_link textcolor=#636363 fontfamily=HelveticaNeue,Helvetica,Roboto,Arial,
   sans-serif]
 * instead of the URL I have added to the custom field.
   here is the code for shortcode
   I am using
 *     ```wp-block-code
       add_filter(    'yaymail_customs_shortcode',    function( $shortcode_list, $yaymail_informations, $args = array() ) {        $shortcode_list['[canva_link]'] = function() use ($args) {            if (isset($args['order'])) {                $order = $args['order'];                $order_id = $order->get_id();                // Retrieve the Canva link from order meta                $canva_link = get_post_meta($order_id, '_canva_link', true);                // Return the link or fallback message                return $canva_link ? '<a href="' . esc_url($canva_link) . '" target="_blank">' . esc_html($canva_link) . '</a>' : 'No Canva link provided.';            }            // Return a placeholder if no order is found (e.g., in editor previews)            return 'No order found (testing in YayMail editor)';        };        return $shortcode_list;    },    10,    3);
       ```
   
 * and for the Custom field i am using this code
 *     ```wp-block-code
       // Add custom field to order edit pageadd_action('woocommerce_admin_order_data_after_order_details', 'add_canva_link_to_order');function add_canva_link_to_order($order) {    $canva_link = get_post_meta($order->get_id(), '_canva_link', true);    echo '<div class="form-field form-field-wide">';    echo '<label for="canva_link">' . __('Canva Link', 'woocommerce') . '</label>';    echo '<input type="text" id="canva_link" name="canva_link" value="' . esc_attr($canva_link) . '" />';    echo '<p class="description">' . __('Add the unique Canva link for this order.', 'woocommerce') . '</p>';    echo '</div>';}// Save the custom field when the order is updatedadd_action('woocommerce_process_shop_order_meta', 'save_canva_link_for_order');function save_canva_link_for_order($order_id) {    if (isset($_POST['canva_link'])) {        update_post_meta($order_id, '_canva_link', sanitize_text_field($_POST['canva_link']));    }}
       ```
   
 * What’s more strange is that when I am adding my shortcode to template instead
   of [canva_link] i see in a preview [object Object].
   Can you help me to solve 
   this, lost few hours on it already.

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

 *  Plugin Support [Bruce](https://wordpress.org/support/users/ninjateamwp/)
 * (@ninjateamwp)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/custom-shortcode-issue-it-doesnt-show-properly/#post-18235449)
 * Hi [@sibivfl](https://wordpress.org/support/users/sibivfl/) ,
 * Thanks for coming here.
 * Let me check this with my colleagues please, I will get back to you soon.
 * Regards,
 *  Plugin Support [mialewp](https://wordpress.org/support/users/mialewp/)
 * (@mialewp)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/custom-shortcode-issue-it-doesnt-show-properly/#post-18235568)
 * Hello [@sibivfl](https://wordpress.org/support/users/sibivfl/),
   Thanks for your
   patience.Please follow our guide to do custom shortcode properly here [https://docs.yaycommerce.com/yaymail/upper-area-of-the-editor-screen/custom-shortcode](https://docs.yaycommerce.com/yaymail/upper-area-of-the-editor-screen/custom-shortcode).
   Also, please note that the custom shortcode must have the prefix **yaymail_custom_shortcode_[‘
   name’]**. Please try again.Many thanks!Mia

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

The topic ‘Custom Shortcode Issue – It Doesn’t Show Properly’ is closed to new replies.

 * ![](https://ps.w.org/yaymail/assets/icon-256x256.gif?rev=2900992)
 * [YayMail - WooCommerce Email Customizer](https://wordpress.org/plugins/yaymail/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yaymail/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yaymail/)
 * [Active Topics](https://wordpress.org/support/plugin/yaymail/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yaymail/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yaymail/reviews/)

## Tags

 * [custom shortcode](https://wordpress.org/support/topic-tag/custom-shortcode/)

 * 2 replies
 * 3 participants
 * Last reply from: [mialewp](https://wordpress.org/support/users/mialewp/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/custom-shortcode-issue-it-doesnt-show-properly/#post-18235568)
 * Status: resolved