How to fix broken iframe widgets in WordPress 4.9.1

Default featured post

The latest version of WordPress (4.9.1) breaks some of iframe widgets. Recently, I have upgraded my site to the latest version and found two of my widgets on right side broken. See below pictures:

Broken Goodreads Widget
Broken Linux Commands Cheatsheet Widget

Root cause

The main reason for this issue is due to using of legacy widget. Years ago, when Custom HTML widget did not exist literally, any HTML code usually injected by adding Text Widget. WordPress 4.8.1 release came with a dedicated custom HTML widget which is obviously is a more elegant solution compare with the text counterpart. In 4.8.1 version use of custom HTML widget did not make any difference (not sure about SEO impacts) except getting some syntax highlighting. However, it seems WordPress developers are trying to pursue users to switch to custom HTML in newer versions and broke the backward compatibility somehow.


The solution is pretty straightforward. Just replace any text widgets contain iframe with custom HTML ones.