• 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

    (@dgann0n)

    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 = "https://$_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.