How can I add an RSS widget using WP-CLI?

I can add an rss widget with this command:

wp widget add rss my-sidebar --title=News --items=5

But when I add a URL parameter, like this:

wp widget add rss my-sidebar --title=News --items=5 --url="https://news.example.com/feed/"

Or like this:

wp widget add rss my-sidebar --title=News --items=5 --url=https://news.example.com/feed/

Or like this:

wp widget add rss my-sidebar --title=News --items=5 --url="https://news.example.com/feed/"

Or any other configuration, it complains Error: Invalid sidebar.. When I add the sidebar and then try to update the URL parameter, with:

wp widget update rss-6 --url="https://news.example.com/feed/"

Or even:

wp widget update rss-6 --url=https:\/\/news\.example\.com\/feed\/    

It says Error: Specified widget isn't present on sidebar. How can I get it to properly add an RSS widget? I feel like there’s something I’m not properly escaping.

0

Leave a Comment