- This topic is empty.
-
AuthorPosts
-
December 22, 2022 at 8:19 am #3472
Christina
GuestIs there any easy way in SlickStack to run a MySQL query or something to easily modify the settings of all child sites in the Multisite network? would be amazing 😀
December 22, 2022 at 8:25 am #3473Aaron
Guestdepends, what setting are you talking about? if about unique settings or values for each site it might require a human to manually modify it one-by-one?
December 22, 2022 at 8:25 am #3474Alexis
GuestI mean for same option in
wp_optionstableDecember 22, 2022 at 8:29 am #3475Evelyn
GuestWP-CLI to the rescue!
Run a WP-CLI command one or more sites on WordPress multisite
wp site list --field=url | xargs -n1 -I % wp --url=% option update my_option my_value
December 22, 2022 at 8:30 am #3476Doris
GuestBitcoin fixes this.
December 22, 2022 at 8:31 am #3477Katherine
GuestAlternative syntax (newer blog post too)
wp site list --field=url | xargs -I % sh -c 'printf "SITE: %\n"; wp option set timezone_string 'Europe/Amsterdam' --url=%'
December 27, 2022 at 5:24 am #3520Kyle
Guestnever knew WP CLI could do stuff like that, awesome 😎
December 27, 2022 at 10:13 am #3531Kathleen
GuestIf you are trying to set an option value in
wp_optionswith serialized data it’s not going to work using the syntax of the commands provided above.Instead this is what worked for me:
1. First, replace the option value network-wide to something easy:
wp site list --field=url | xargs -n1 -I % wp --url=% option update my_option lolcow
2. Then use string search/replace like this:
wp search-replace --network 'lolcow' 'a:1:{s:1:"ex_key";s:2:"account";s:3:"ex_value";s:4:"346345734";}' --all-tablesThis works better cuz its meant for string replacement.
You can put
--dry-runto test it first too.December 27, 2022 at 10:20 am #3532Jennifer
GuestJanuary 6, 2023 at 4:07 pm #3669Lisa
GuestSeems like a good opportunity for someone to release a premium “manager” plugin for doing all kind of tasks for WP Multisite
February 21, 2023 at 6:14 pm #4277Matthew
Guestrelated plugin?
-
AuthorPosts