Support » Fixing WordPress » Paragraph tags around shortcodes in widgets (WP 5.8)

  • I know this topic comes up from time to time, but I could not find anything recent.

    I created a shortcode that displays an unordered list enclosed within div tags. This shortcode works as expected (i.e., just displays the div and its content) if I add it via the shortcode block to a page or post.

    However, if I add the same shortcode via the shortcode block to a widget, my div is enclosed within paragraph tags.

    This is an issue with WP 5.8 specifically. This same shortcode worked as expected in the text widget in WP 5.7.2, and it also works as expected in that same text widget (now a “legacy widget”) in 5.8. The issue is only occurring when I add the shortcode block to a widget in WP 5.8.

    I’m sorry I do not have a link as this is a temporary test site that will be going away soon. My test site is running the Pressbook theme (was also being used in WP 5.7.2 where this issue did not occur) and it has no plugins besides the small plugin that adds the shortcode in question.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @jjbte

    It could be related with the widgets’ update on WordPress 5.8. Try to install and activate the “Classic Widgets” plugin.

    Have a nice day

    Thread Starter jjbte

    (@jjbte)

    Hi @amieiro. Thank you for your reply and suggestion. This seems like it has to be a bug in WP 5.8. I am hoping I won’t have to install a plugin to fix it. I do like the idea of using blocks in widgets, so I hope I won’t have to give up a new feature because of a bug that should be fixable.

    I do like that the plugin you suggested is built by WordPress folks and they have promised to maintain it through next year.

    Thanks again, and you have a nice day too! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.