1

I want to add a YouTube video to a widget via wp-cli. The YouTube video is basically an iframe. When I execute the following command:

wp-cli widget update text-1 --text='<iframe src="http://example.com"></iframe>'

the text of the widget is empty. It seems either wp-cli or wordpress is stripping away the iframe tags. Via the wordpress backend it is possible to add arbitrary html to a text widget. But via wp-cli it does not work.

Is there some command line option or workaround? Going directly via the DB with MySQL would be the last option.

Thx in advance!

1
  • maybe a dumb question but is the name of the widget "text-1"? If it is, can you try updating the title like in this command? wp widget update test-1 --title="Our Calendar" maybe the field you want to update is not called "text"?
    – Robbiegod
    Jun 29, 2017 at 19:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.