Title: Shortcode Execute Twice
Last modified: June 7, 2017

---

# Shortcode Execute Twice

 *  [dgann0n](https://wordpress.org/support/users/dgann0n/)
 * (@dgann0n)
 * [9 years ago](https://wordpress.org/support/topic/shortcode-execute-twice/)
 * Hello,
 * I need some input on a problem that’s occurring. When I use a shortcode in the
   page builder, everything displays fine. But when I am using the page builder 
   editor, it executes the shortcode twice. This is going to confuse my client when
   they use the page builder editor because it LOOKS like the shortcode is being
   excuted twice, but on the LIVE page it only displays once.
 * For a simple example, a shortcode in my functions.php file would be this:
 *     ```
       function my_shortcode(){
       	?><h2>Hello</h2><?php
       }
       add_shortcode('danielles-shortcode', 'my_shortcode');
       ```
   
 * Then of course, the shortcode call is [danielles-shortcode]. I’m not asking why
   THIS shortcode isn’t working (theres nothing wrong with the shortcodes, this 
   is just a simple example), I am more wondering why the page builder EDITOR page
   executes all shortcodes twice.

Viewing 1 replies (of 1 total)

 *  Thread Starter [dgann0n](https://wordpress.org/support/users/dgann0n/)
 * (@dgann0n)
 * [9 years ago](https://wordpress.org/support/topic/shortcode-execute-twice/#post-9206104)
 * My workaround – if anyone ever has this issue – is to add a check for if the 
   URL contains “elementor”, then we know we are on the Elementor Page Builder Editor
   and to do nothing, else if it isn’t on an elementor page builder editor then 
   run the code.
 *     ```
       $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
       	if (strpos($actual_link, 'elementor') == false) {
       	    // run code here
       	}
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Shortcode Execute Twice’ is closed to new replies.

 * ![](https://ps.w.org/elementor/assets/icon-256x256.gif?rev=3444228)
 * [Elementor Website Builder - more than just a page builder](https://wordpress.org/plugins/elementor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/elementor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/elementor/)
 * [Active Topics](https://wordpress.org/support/plugin/elementor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/elementor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/elementor/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [dgann0n](https://wordpress.org/support/users/dgann0n/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/shortcode-execute-twice/#post-9206104)
 * Status: not resolved