Support » Plugin: Jetpack by » Jetpack processes shortcodes twice?

  • Resolved zingiri


    It seems that after activating Jetpack, WP shortcodes are processed twice. Once as part of the wp_head() execution (unexpected) and once in the loop (as expected).
    I suspect this is because of an additional do_shortcode() call in one of the Jetpack actions.
    Can this be resolved or is there a way to avoid shortcodes to be triggered inside the header?

Viewing 15 replies - 16 through 30 (of 32 total)
  • Actually sorry, just updated to jetpack 2.1.1 and all seems clear. Not running shortcodes twice anymore. Thanks for the fix!

    I really hope you guys find some kind of work around. 🙁

    hey bobby this should be fixed in 2.1.1, it’s fixed here.

    Perhaps you had a different bug; the stack-trace I produced above showing the double-call was on 2.1.1.

    not so for me smartypants. I’m getting the error with my galleria shortcode. the newest jetpack update didn’t fix my problem. See the error on the slider “Init failed: Galleria could not find the element “#galleria-1″.”

    I started getting the error on 2.1.1

    I did not have that error initially when I upgraded it 2 weeks back the error happened 4-5 days ago, some thing got changed at that point

    I have the same problem of [shortcode]text[/shortcode]
    called twice.
    WP 3.5, no jetpack, just plain shortcode as in Codex:

    function bibl_func($atts, $content = null) {
          'title' => 'some title',
          'clickme'  => 'click me'
       ), $atts));
    //       if (is_null($content)) return ""; // did not help
           return '<div class="clickme" style="cursor:pointer;"> click me! </div><div class="bibl">'. $content .'</div>' ;
    add_shortcode('bibl', 'bibl_func');

    Any idea how to solve it?

    Hi Tim,

    Any updates on this,

    Plugin Contributor Tim Moore


    This isn’t a Jetpack bug:

    To summarize the link: Jetpack uses the get_the_excerpt function properly. Other plugins/themes are not, which is causing the post content for these posts to get generated twice, thus processing the shortcodes twice.

    Despite that, we’re going to look at changing the Jetpack code from the current, proper way of doing this to another way to alleviate some of these issues for Jetpack users.

    Be aware, though, that while this will solve an incompatibility with Jetpack, if you run another plugin that, like Jetpack, is doing_it_right, you’ll see these same issues crop up again.

    What is the other solution, most of the shortcodes I have is custom plugin, which are all basic plugins, and using the shortcode API

    This still not fixed on the new version

    Plugin Contributor Tim Moore


    @manoj: we’ve put a fix in place in Jetpack 2.1.2. If you can share what plugin or code you are having an issue with, we can try to help.

    This is a test function

    function foobar_func( $atts ){
    echo “Shortcode Test Successfull”;
    add_shortcode( ‘foobar’, ‘foobar_func’ );

    Plugin Contributor Tim Moore


    In shortcodes, you need to return the data, not echo it. Try:

    function foobar_func( $atts ){
    return "Shortcode Test Successfull";
    add_shortcode( 'foobar', 'foobar_func' );
Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘Jetpack processes shortcodes twice?’ is closed to new replies.