[wp-hackers] Problems with shortcode function in plugin

Aaron D. Campbell aaron at xavisys.com
Mon Dec 29 18:02:31 GMT 2008


Are you echoing the content or returning it?

Ade Walker wrote:
> Hi all,
>
> I am upgrading a plugin of mine to have a shortcode for those users who
> don't like editing their template files.
>
> So, I added the add_shortcode hook to my plugin file, and call the main
> plugin function within this hook. This works fine in that I can add the
> shortcode when writing posts and the plugin's output appears within the
> post. My problem is that the position of the shortcode within the post
> content (whether, in Edit Post, I insert it at the beginning, middle or end
> of the post) is completely ignored and the plugin output always appears at
> the beginning of the post content. I'm using the_content to display the post
> content in my test setup.
>
> Clearly I am misunderstanding something basic about the shortcode API, so if
> anyone can point me in the right direction it will be much appreciated.
>
> Thanks!
>
> Ade.
>   


More information about the wp-hackers mailing list