Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to import/add widgets to a specific sidebar from a file? #59

Open
dashaluna opened this issue Jul 25, 2023 · 2 comments
Open

Comments

@dashaluna
Copy link

Hello,

Is it possible to import/add widgets to a specific sidebar from a file?

For example, when there is a need to copy over widgets for a specific sidebar only from one environment to another.

I can get a sidebar widgets info into a file using the following command:
wp widget list sidebar-ID --format=json > file-name.txt

But I can't see if it's possible to add widgets to a sidebar from a file.

Perhaps there is a different way of doing this? Is it at all possible?

I'd really appreciate any tips. Thank you!

@swissspidy
Copy link
Member

I don't think wp widget list is intended for exporting widgets like that, so it does not seem possible with this command.

There are ways to migrate all widgets using the wp option command, if that's at all helpful.

It might be possible to use combinations of wp option get, jq (to extract only a specific sidebar) and wp option patch (to make a partial update to the widgets option) to achieve what you're after, but that's just a thought.

@swissspidy
Copy link
Member

Related: wp-cli/ideas#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants