[wp-hackers] My plugin doesn't work online :( Shortcode loading order?!

Otto otto at ottodestruct.com
Mon Mar 26 19:38:14 UTC 2012


On Mon, Mar 26, 2012 at 1:56 PM, Diana K. Cury <dianakac at gmail.com> wrote:
> Sorry for bother,
>
> I just can't understand why my plugin isn't working, the post type screen is ok, but the shortcode action does'nt work at all.
>
> When adding [mensagem], it supposed to add the form into the page, but anything show up when doing so :(
> ...
>    add_shortcode( 'mensagem', 'mensagem_shortcode',6 );
> ...
> //cria shortcode
> function mensagem_shortcode() {
>    do_action('wp_head','mensagem_form');
>    include('form.php');
>  }


Shortcodes are never, ever, supposed to produce output. They're
supposed to *return* output.

A shortcode is, basically, a filter.

Give this a quick read:
http://ottopress.com/2011/actions-and-filters-are-not-the-same-thing/

Also, that isn't how do_action works. Not sure what you're trying to
do there, actually.

-Otto


More information about the wp-hackers mailing list