I’m trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe.
I’ve tried using the “Text” widget and pasting the iframe code in there, but when I save the widget, the iframe code disappears.
I’ve come across this problem/limitation before and solved it using the IFrame Widget, but I want to use more than one iFrame in my sidebar, and the IFrame widget only supports one widget at a time.
Am I missing something obvious? Is there a setting somewhere to allow iframe code in the widgets? Or is it normally allowed, and I’ve done something silly to my install? If not, any good workarounds?
Just create a widget that doesnât filter your input. This is probably the most simple widget with user input you can build.
Here is the widget I use in my plugin Magic Widgets.
You register the widget with:
Now you get a new widget in
wp-admin/widgets.php
:I put just two cool Youtube videos as iframes and a
<hr>
into the widget.Output:
To update the answer in question, as of WP 4.8 site that I have tested, the regular text widget can now natively display iframes by simply using the regular iframe tag: