• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

WP Thinker

The WordPress Playground

  • Snippets
  • Best
  • Guides
  • Reviews
Home / Wordpress

October 22, 2018 Muhammed Swalih

How to Use Shortcodes in WordPress Sidebar Widgets

Use Shortcodes in Wordpress Sidebar

Ever faced a problem when you tried to attach any shortcodes to the sidebar of your WordPress website? Did it output a result like below image?

shortcode-problem-in-sidebar
Credit: Wpbeginner

If so, we have the solution for you. Continue reading this article to find out, how to use shortcodes in WordPress sidebar without getting any errors.

Why Shortcodes not working in Text widget?

If you think. Ha, yes. I just have to enter the shortcode to the text widget as I do in the visual composer, or inside the posts, you got it wrong. By default, WordPress widget has a filter that filters out the shortcodes and uses it as plain text. So, you should bypass this to make your shortcodes working in widget areas.

Method to Use Shortcodes in WordPress Sidebar Widgets

If you ever wanted to use the shortcodes in your sidebar widget, just open the functions.php file of your theme and place the following code there.

// Enable shortcodes in text widgets
add_filter('widget_text','do_shortcode');

Now, you can visit Appearance > Widgets to place your shortcodes in the text editor widget that comes default with the WordPress.

It will work for you and now, the shortcodes will be working fine in your WordPress widget areas. If you faced any problems or need further help, feel free to drop a comment. We will get back to you ASAP.

Avatar for Muhammed Swalih

Muhammed Swalih

A WordPress expert who has been tweaking WordPress functions, plugins, themes and almost everything related to WordPress for the past 5+ years.

Primary Sidebar

Related Articles

Footer

WP Thinker is a website that publishes everything related to WordPress, Plugins, Themes, SEO, Blogging, etc.

  • Facebook
  • Twitter
  • Pinterest

Copyright © 2023 · WP Thinker

  • About Us
  • Advertise
  • Write for Us
  • Privacy Policy
  • Terms and Conditions
  • Contact Us
This website uses cookies to serve you better. By continuing to use this website, you agree to our cookie and Privacy Policy.