Tips

Problems with Shortcodes in Text Widgets

The text widgets of WordPress 4.8 came with a new feature – a HTML editor. That is great for people who want to format their text, but it is also bad news since the TinyMCE editor tends to clean up or reformat the original code. For example, “=>” gets converted into the HTML-safe encoding “=>”, and so the “greater than sign” has no effect anymore on the structure of the HTML page but will be interpreted merely as part of the content. It is clear that this change breaks every code where the “=>” is required literally.

I recently noticed that also shortcode parameters wrapped in double quotes seemed to receive the quotes as part of the text. As a direct result, these quotes stopped doing their job as a wrapper for a text that may contain spaces. For example,

text="Click here!"

now breaks at the space and the parameter “text” receives the value

"Click

instead of the entire Click here!.

There are various possible solutions how to deal with the problem, for example with tooltips (“help pointer”). They don’t, however, help you solve the mentioned problems. I’m afraid that users simply click them away, like Jetpack’s tooltip that tells me about their Twitter widget or the tips for first-time users. Considering the importance of the matter, these notices should be formatted as alerts.

The only solution that makes sense to me now is to return to a text widget that works exactly like before. I tried the Classic Text Widget, and it seems to do it’s job. Similar problems, however, might appear later with WordPress 5.0 when the new editor Gutenberg (presently still a plugin) is scheduled to become the new standard.

 

Photo by byzantiumbooks

Check Out My Plugins:

Organize your tags in coherent groups and tidy up your tag cloud! Display your tags under tabs or in an accordion.

You will never want to go back to the times when your tags were all over the place.

FREE

Supercharge your tags! Tag your posts on two levels with tag groups. Filter your posts on the frontend. Let your visitors search in real time by tags and groups.

Go directly to your first, latest or a random post just by adding some magic words to your site's URL. Search posts by author, or category, or something else. Or combine a time frame with search parameters.

FREE
Christoph