Shortcodes in HTML Widget

resolved

#1

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?


#2

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' );


#3

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


#4

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


#5

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


#6

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.


#7

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


#8

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


closed #9

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