InMotion Hosting Support Center

By default, WordPress shortcodes do not work within Text widgets. If you need this functionality, it is quite easy to accomplish, simply follow the steps below.

Using Shortcodes in a WordPress Text Widget

  1. Log into your WordPress Dashboard
  2. Under "Appearance" click "Editor"
  3. In the list of files on the right of the page, click "functions.php"
  4. At the bottom of the functions.php file, add the following code:
    add_filter( 'widget_text', 'shortcode_unautop');
    add_filter( 'widget_text', 'do_shortcode');
    editing your themes functions.php file
  5. Click "Update File" and your shortcodes should now work in your Text widgets!

    Before: After:
    before shortcodes could be used in text widgit after shortcodes can be used in a wordpress text widgit

Changes made to these files may get overwritten after theme updates. It is always recommended to make these kinds of modifications in a child theme.

Was this article helpful?
Continued Education in Course WordPress
You are viewing Section 56: 313: How can I use shortcodes within a WordPress Text widget?
Section 55: 315: Broken Link Checker Plugin for WordPress
Section 57: 316: Using InMotion Hosting's Memory Viewer WordPress Plugin

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

n/a Points
2017-09-26 7:56 am

hey!i'm using genesis framework with 'genesis sample develop' child theme. The problem i am getting is that, this theme is not rendering any shortcodes and html in text widget even after i includingadd_filter( 'widget_text', 'shortcode_unautop'); add_filter( 'widget_text', 'do_shortcode', 11);to my child theme's 'function.php' file. Please help me out......Thanku

11,000 Points
2017-09-26 2:40 pm
You'll want to make sure you are adding the code to the functions file created for the child theme instead of the parent theme. Otherwise, I would suggest contacting Genesis to see if they have a suggestion.
n/a Points
2017-03-21 8:14 am

Hey Guys,

I've changed my functions.php file to allow me to post shortcode to a text widget. My only problem now is that every text widget is showing this shortcode on my page. I'm specifically refering to using a table shortcode.


Please help I'm new to all of this

11,000 Points
2017-03-21 9:12 am
I was not able to replicate that behavior using the WordPress twenty ten theme. It's possible there could be a theme or plugin conflict in your installation.
n/a Points
2016-07-08 7:12 am

Huge, HUGE THANK YOU ! You saved me, you really did. Thanks a lot !

n/a Points
2016-02-10 4:01 pm

Thanks for your work!In my theme I have an area in the top bar where I can add text only in the customization. Is it possible to insert a shortcode there? 

I use MaxStore in Wordpress with Woocommerce.

Thank you!

42,829 Points
2016-02-10 4:41 pm
Hello Apfelsinchen,

Thanks for the question about the shortcodes in your theme. Typically, shortcodes are only usable in the posts/pages section of WordPress. If you need more information on the customization options for your theme you will need to consult with the theme developer.

If you have any further questions or comments, please let us know.

Arnel C.
n/a Points
2015-05-24 3:19 pm

Hi Sir,


 its doesn't work for me 

i am using dream theme 7.2

Plz help



10,077 Points
2015-05-26 10:32 pm
Hello Ricky,

What happens when you add the code to your functions.php file? You may need to contact theme forest to see if they have another method for their themes.

Best Regards,
TJ Edens
n/a Points
2014-12-12 12:06 am

function hs_shortcode()




return ob_get_clean();





hi this is my shortcode function now i have to display shortcode after the plugin content

11,186 Points
2014-12-12 9:56 am
To clarify, are you referring to showing the shortcode content at the end of the post content?
n/a Points
2014-12-11 4:02 am

Hi i create a plugin i am getting shortcode also but i have to display shortcode after the plugin content

31,539 Points
2014-12-11 10:42 am
Hello dileep,

Thank you for contacting us. We are happy to help, but I am not sure what you are asking.

Please provide more information, so we can better assist you.

Thank you,
n/a Points
2014-08-10 10:18 am

It's working...Thank you very much

n/a Points
2014-07-08 9:01 am

Do you have the same code for excerpt text area


31,539 Points
2014-07-08 9:44 am
Hello Boris,

Thank you for your question. I found a similar question in the Official Wordpress forums, where they present several ways to enable shortcodes in excerpts.

If you have any further questions, feel free to post them below.
Thank you,

n/a Points
2014-06-27 3:55 am

i used LPN theme for wordpress ... and the latest version of wordpress .. and the shortcode is [indeedsearchform] ... anyways i found solution .. the shortcode works on pages, so i make a page and run this shortcode on that page and than parse it to the index page ... 

n/a Points
2014-06-25 5:36 am

It does't work for me !!! :(

43,761 Points
2014-06-25 9:18 am
Hello Husnain,

Sorry to hear you tried it and it did not work. What theme are you using? What version of WordPress are you using? Which shortcode did you test with to see if it worked?

Kindest Regards,
Scott M
n/a Points
2014-04-27 10:01 am

wow!!!!!! you are awesome dude!!!this is what I've looking for!!


43,761 Points
2014-04-28 1:11 am
Hello Dimas,

Thank you! We are glad to help!

Kindest Regards,
Scott M
n/a Points
2014-04-22 5:00 am

How can I enable contact form shortcode in HTML area( Where only allow html tag ) .

[contact-form-7 id="2358" title="Contact Form 1"]

11,186 Points
2014-04-22 7:57 am
If it's an HTML-only area, shortcodes cannot be added. You would need to use a normal location or create the form using HTML instead.
2013-09-06 6:49 am
its awesome man!
thanks a lot man
its working awesomely

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

24 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!