Add Shortcodes in Widgets

If you use shortcodes within your WordPress theme you might need to also add them within your widgets. This little snippet does the trick.

To allow shortcodes in widgets all you need to do is add this little snippet to your functions.php file

add_filter('widget_text', 'do_shortcode');

Jake Bresnehan

A Front End Developer based in Sydney and the creator of Web Design Weekly.

Web Design Weekly keeps developers at the forefront of techniques and trends whilst helping them learn and grow to produce top quality code to make the web a better place for all.

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *

Current day month ye@r *