How to Use Shortcodes in WordPress Sidebar Widgets

In past, PHP Tricks shown you how to CREATE SHORTCODE in WordPress. Next there is most searchable question is that How to use these shortcodes in WordPress sidebar widget. So Today PHP Tricks provide you way to do this in few minutes.

Why Shortcodes Does not work in Widget sidebar inside WP-ADMIN ??

When you add some shortcodes in sidebar widget and think this will execute then you are wrong. Actually WordPress filters execute widget content as simple text and you get shortcode itself as plain text instead final result.



Now there are two to easily enable shortcodes in sidebar widget.

Way 1 : Using WordPress Plugin

In this way, we will use simple WordPress plugin and you need to install and activate the Shortcode Widget plugin.
After activation, you need to go Appearance » Widgets page. There you will find a shortcode widget in the list of available widgets.

Way 2 : Using WordPress code

You can also enable shortcode functionality in sidebar widget by adding  following code in your functions.php file.

// Enable Shortcode reading functionality in sidebar widget

Above code enables to render shortcodes functionality inside sidebar widget.


From above both way, you will see your shortcode is now working at front website



Categorized as WordPress

By Ashutosh Pratap

I am software developer by profession and doing work and research in field of Computer programmings like PHP, WordPress, Magento, jQuery, Google APIs and many more web languages. Apart from this I write blogs on programming languages like PHP, Javascript, WordPress etc. I am also individual and independent Freelancer so you can hire me for your web work.

Leave a comment

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