Title: Shortcode appearing outside content
Last modified: August 22, 2016

---

# Shortcode appearing outside content

 *  [AalokK](https://wordpress.org/support/users/aalokk/)
 * (@aalokk)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-appearing-outside-content/)
 * m using insert php code snippet to create php code and then using the shortcode
   eg [xyz-ips snippet=”classification-form”] in the content
 * but the code comes outside the modal
 * Why? this happens only on my version of php xampp 5.3.1
    on 5.2 it works ok
 * [https://wordpress.org/plugins/easy-modal/](https://wordpress.org/plugins/easy-modal/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-appearing-outside-content/#post-5499548)
 * It sounds like that shortcode is executing and echoing, rather than executing
   and returning.
 * Shortcodes don’t echo, they are supposed to return a string variable for instance.
 * Incorrect
 *     ```
       function my_shortcode($atts) {
         echo "string";
         ?>Hello World<?php
       }
       ```
   
 * Correct
 *     ```
       function my_shortcode($atts) {
         $content = "string";
         $content .= "Hello World";
         return $content;
       }
       ```
   
 * Now that said im not familiar with the plugin you referenced but likely your 
   php function isnt returning as above, and the plugin simply executes the function
   which echoes to the head when we preload the modals in the head to check for 
   other plugins shortcodes to make them compatible like Gravity Forms.

Viewing 1 replies (of 1 total)

The topic ‘Shortcode appearing outside content’ is closed to new replies.

 * ![](https://ps.w.org/easy-modal/assets/icon-256x256.png?rev=982657)
 * [Easy Modal](https://wordpress.org/plugins/easy-modal/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-modal/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-modal/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-modal/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-modal/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-modal/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-appearing-outside-content/#post-5499548)
 * Status: not resolved