Why does my shortcode get executed before other content?

后端 未结 2 1848
臣服心动
臣服心动 2020-12-11 23:08

I have the following text in a page. As you can see my shortcode is right at the bottom but somehow when the code runs, the output of my shortcode is inserted at the top of

相关标签:
2条回答
  • 2020-12-11 23:44

    You can use as alternative:

    ob_start();
    ...your code...
    return ob_get_clean();
    

    and use without return the html as string.

    0 讨论(0)
  • 2020-12-11 23:47

    Your shortcode handler is supposed to return the output to display in place of the shortcode, not output anything itself.

    http://codex.wordpress.org/Shortcode_API

    0 讨论(0)
提交回复
热议问题