Shortcodes in HTML Widget

I seem to remember shortcodes used to work in HTML widgets, but now they dont? Is this a CP thing, or is this a WP thing? or am I simply misremembering?

They still work in both WP and CP. But, in either case, you need to ensure you have set the appropriate filter, namely:

add_filter( 'widget_text', 'do_shortcode' );


Just confirming that ClassicPress didn’t make any changes here. Thanks Tim for the code snippet.


What @timkaye is giving is for the text widget, right? I am referring to the custom HTML widget.

I believe that code snip that Tim posted should cause shortcodes to work in any widget. Did you try it?

1 Like

I did not try it yet, I’ll do that then. I am always a bit hesitent to just add code to my functions till I know what exactly it does, haha.

1 Like

That is understandable. If you ever need to enable shortcodes in excerpts, there is a similar code snip you can use.


I tried @timkaye 's code snippet and it seems to have done the trick. Thank you!


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.