How To Fix : Custom WordPress HTML Widget Error ! Won’t Allow To Save

The Custom WordPress HTML Widget in WordPress editor wonโ€™t allow me to save and throws few errors. The save button is disabled.

I have updated to Word Press to the version in my self hosted WordPress Blog. I have been trying to post affiliate link code in the custom HTML widget, but it wonโ€™t allow me to save. It shows coding errors, like the image shown below.

wordpress html widget

I get the following message at the bottom of the widget when editing โ€œThere are 2 errors which must be fixed before you can save.โ€.

The errors indicated were simple to fix, and then I could save the code. The code worked perfectly. But since it was an Affiliate link code, I didnโ€™t want to temper with their code.

Check out: How To Improve The Page Speed Of Google AdSense Site

Because this would amount to a violation of their TOS. I could get my AdSense account banned.

This issue was discussed in the wordpress.org support forum by other bloggers also, but no definite answers.

After much search and discussion with fellow bloggers, I came across this plugin called Magic Widgets. In short, it works and no more error message.

How to fix Custom WordPress HTML widget error:

Log on to your WordPress dashboard > under plugins > click on Add new plugin > search for Magic widgets plugin. Download > install the plugin and then activate it.

You might see the following warning message on the plugins page. But I have installed and I have already updated my WordPress version to 5.2.1 with no issue with this plugin.

wordpress html widget

โ€œMagic Widgetsโ€ is open-source software. Under appearance > widgets page, this plugin creates a new widget, called Unfiltered Text.

Very similar to the regular text widget, but it doesnโ€™t insert any extra markup. Donโ€™t get confused, as you wonโ€™t see any widgets with the name as Magic widgets.

wordpress html widget

You can use this Unfiltered text widget for any Html or iFrame codes, especially affiliate links whether Amazon or Flipkart.

If you are not getting any error while using the custom HTML widget than go ahead and use that only.

I have no explanation why, but most affiliate links throw up these errors with the custom HTML widget. So I use this Unfiltered text widget for all my affiliate links, and no more error message, nor do I have to alter the affiliate code.