Get a sneak peek at the new Custom HTML Text Widget in WordPress 4.8.1.
The devs made a way to safeguard your custom code in existing Text Widgets so that it doesn’t get stripped out as you make the switch to the new Custom HTML widget.
Subscribe to the BlogAid YouTube Channel
for more helpful tips just like this
This new widget will take the place of the original Text Widget that we had in previous WordPress version.
I created a sandbox site with WordPress 4.7.5 and then I loaded a couple of regular Text Widgets with the type of code that got stripped out in WordPress 4.8.
Then I updated to the beta release of WordPress 4.8.1.
You can see my Text Widget here.
And you can see that I’m in the Text View mode of this rich text editor.
The code has a call to a CSS class location in the link part of the code.
And then it has an unordered list item.
When you switch back to the Visual mode, that special CSS class code gets stripped out.
When I jump back to the Text view mode it’s gone.
Now, when I first opened this widget, a new pop up message appeared.
I took a snapshot of it because I can’t get it to reappear on demand again.
It opened the widget in the Text view mode, so the code wouldn’t get stripped out.
And it alerts you that there is a new Custom HTML widget in the Available Widget’s section.
You can dismiss this message.
Now, let’s say that I had left this widget in the Text view mode when I had first opened it, and the original code was still there.
Let’s put that back.
While you still have this widget open, click the Custom HTML widget tab and place it where the original widget is. In this case, it’s the Main Sidebar.
Now you can copy and paste the code from the original Text Widget to the new Custom HTML Widget without it being stripped.
I had also created a second Text widget while the site had 4.7.5 loaded.
And when I opened it, there was a notice stating that WordPress had detected the HTML code and it advises me to use the new Custom HTML widget instead.
I believe this is the notice you will see on all of your widgets that have HTML or other custom code. That initial pop up notice was just to get your attention and let you know where the new Custom HTML widget is located.
Now, I haven’t tested every type of custom code, but I believe it will be safe for most of us to update to WordPress 4.8.1 when it rolls out to the public.
You may want to test on a sandbox site if you can, just to be sure.
It’s a time suck to have to change over all of your Text widgets, but hopefully it will just be this once and we can all move ahead with the other sweeping changes coming to WordPress in the near future.