Enable shortcodes in widgets
Quick tip to enable WordPress shortcodes to be executed in widgets (and post content).
Enable WordPress shortcodes in widgets
Just add the following line to your theme’s
Enable WordPress shortcodes in post content
By default, shortcodes should be executed in WP Posts and Pages. If for whatever reason that is not happening, you can try adding the following snippet:
add_filter('the_content', 'do_shortcode', 10);
Here are both of the previous snippets together, ready for quick grab, gulp, & go:
// execute shortcodes in widgets and content add_filter('widget_text', 'do_shortcode', 10); add_filter('the_content', 'do_shortcode', 10);
Nothing to configure, that’s all there is to it.