Webdancers clients who spend time in their WordPress admin area may have noticed a new type of widget appearing under Appearance > Widgets, called the “Classic Text Widget”. The addition of this widget was necessitated by a change in the behavior of the native “Text Widget” in WordPress 4.8. If you want to stop reading here, just use the Classic Text Widget in the same way as you used the old Text Widget and all will be well. For the full story, read on.
Since the very early days of WordPress, the Text Widget was used to add plain text and arbitrary HTML in widget areas. It was handy for both short snippets of text and for more complex blocks of HTML used for things like Facebook cards and contact information with micro formatting. Even though it didn’t do very much, the Text Widget was used extensively, anywhere that a block of unformatted text was needed.
All that changed in version 4.8. A small toolbar was added to the Text Widget, to allow the easy addition of formatting like bold and italics, plus the same interface for adding links that is found in the main editor. The widget also has Visual and Text tabs, also like the main editor. Seems like a nice addition to a simple widget, right? And it would have been, except for one thing: The widget also inherited another feature of the main editor, which strips out HTML code it doesn’t recognize or thinks is invalid. A lot of this kind of code is perfectly OK and is used in WordPress sites all over the web. A fair amount of teeth-gnashing by web developers ensued.
If left unchanged, a Text Widget containing offending code could have that code automatically removed after being upgraded to WordPress 4.8, potentially breaking important parts of the site. Enter Classic Text Widget. A developer named Victor Font went back into the pre-4.8 WordPress code base and recreated the old Text Widget, making it available in the WordPress plugin repository. As of this writing, it has been downloaded over 2,000 times and has a 5 star rating. Because WordPress is open source software, solutions like this are perfectly legal and encouraged.
The WordPress team also realized that they had created a problem and in version 4.8.1 included the “Custom HTML” widget, which does exactly what the old Text Widget (and Classic Text Widget) does. This however introduced a chicken and egg problem, because you didn’t get this new widget until after upgrading to 4.8.1. In an abundance of caution, I opted to use Classic Text Widgets on all sites under Webdancers management and move all vulnerable text into them before upgrading. Going forward, I’ll use the native WordPress Text and Custom HTML widgets for their intended purposes.
All sites have been transitioned and are up to date. And now you know the whole story about the great Text Widget shuffle.