You’re probably here because you noticed that your shortcode isn’t working, instead it’s just showing as text.
No worries! This is by default. There is a quick fix for this. Imagine you want to show your related posts in the sidebar or social share icons in the navigation, or anything else that you created a shortcode for.
I assume you already know how to edit your files. If not, I recommend you to always use the child theme so that you don’t overwrite any core files from your theme. After a theme update, the files will always get overwritten. A child theme doesn’t receive an update so it’s save to add new files/code.
You can also add it via
Appearance > Theme editor > Your CHILD theme > functions.php
Add the following code to your
// Enable shortcodes in navigation and (sidebar) widgets. add_filter( 'widget_text', 'do_shortcode' );
That’s it! You can now use your shortcodes as a widget or navigation item.
If you found this article helpful, got a question or spotted an error/typo... Do well to leave your feedback in the comment section or help spread it by sharing this article. If you're feeling generous (and I hope you do) you can definitely help me by getting me a cup of coffee ☕.