Using shortcodes in your WordPress Sidebar Widgets

For those that are familiar with WordPress you’ll know that shortcodes are normally ignored if you try putting them in a sidebar widget, and all that’s displayed is the shortcode itself. In this article, we will show you how to use shortcodes in your WordPress sidebar.

To allow shortcodes in sidebar widgets, follow these simple steps:

  • Login to your WordPress admin and go to the 'Theme Editor'
  • Locate 'functions.php' and click on it to load the editor
  • Add the following snippet of code between the php tags, making sure it’s not in the middle of a function that may already be in the file:

    add_filter('widget_text', 'do_shortcode');
  • Click 'Update File' to save your changes.

Once completed, you can now add as many shortcodes as you want in sidebar widgets. It’s as easy as that!