shortcodes output before content [duplicate]
Shortcode callbacks have to return, not output. So use the following: function test() { return ‘-TEST-‘; } add_shortcode( ‘testshortcode’, ‘test’ ); More info: http://codex.wordpress.org/Shortcode_API If you have to use echo you can also do it this way(useful if there’s a lot of markup & it’s difficult working with strings)- function test() { ob_start(); echo ‘-TEST-‘; … Read more