How to Enable Shortcodes in WordPress Widgets

By default, wordpress shortcodes can only be used in post and page post types not in widgets. If you use shortcodes in widgets then simply text will be display in your blog. But If you also want to use shortcodes in widgets. Then we will guide you propellry to display shortcodes in widgets. In this very short tutorial Im going to share a little snippet to enable shortcodes in WordPress widgets.

Check Out: How to Detect WordPress Theme and Plugins in Competitor Site

How to Use Shortcodes in Widgets:

To add shortcode support in widgets, You need to follow these simple steps.

  1. Go to your wordpress admin dashboard.
  2. Now go to Appearance>Editor>functions.php file.
  3. In functions.php file paste the following code just bellow <?php.
// Add shortcode support to widgets
add_filter(‘widget_text’, ‘do_shortcode’);

4. After adding code, save the file.

Now Go to Widgets section and try to add shortcodes in text widget and save.

Now refresh your site front end and you will see awesome widget in live action.

Note: Make sure you have’t used any cache plugin in this time. If using then clear cache first.

Here is the Snapshot For Testing the Code:

enable shortcode in widgets


If you like This Tutorial, Then Share your Views and also share with your bloggers friends.

Say Something About This Post: Don't Spam