WordPress – Shortcodes in custom widget

Few days before, I developed a WordPress custom widget as per requirement and in that I was using textbox and textarea for inputting data. I was using HTML tags and Shortcodes in custom widget but Problem was that short-codes rendering out as text.

in my functions.php file I have added the add_filters for short-codes to display in text widgets.

But it was not working. Then I googled on it and find it out that ‘widget_text’ filter work for the standard text widget. I have tried just about everything and its driving me crazy.

But at last I got the solution that If I will directly use do_shortcode function on the textarea value then it will execute all the shortcodes exists in the textarea. So simple use below given code to execute Shortcodes in custom widget for WordPress.

You Might Interested In

Leave a Reply

Enclose a code block like: <pre><code>Your Code Snippet</code></pre>.