Use Custom HTML instead of Text widget for shortcodes
Some WordPress themes users experience the following issue: when placing shortcodes in Text widgets, WordPress automatically adds paragraphs for the text, which in some situations may cause the shortcode to display incorrectly. These additional "unnecessary" paragraphs may result in incorrect widget styling.
How to resolve the issue of automatically adding paragraphs in text widgets?
The best way to solve this problem is to use a Custom HTML widget instead of a Text widget. For the Custom HTML widget, paragraphs are not added and the shortcodes will be displayed 100% correctly.
All you have to do in this case is to copy the shortcode into the Custom HTML widget.
How to manage Custom HTML widgets in WordPress?
Navigate to WordPress dashboard -> Appearance -> Widgets
Here you’ll find the Custom HTML widget:
This is how the Custom HTML widget looks like in the backend of a WordPress website:
- The widget’s type
- The place for the title
- A place to enter the content - for example, a shortcode