5

I have a multisite instance of WordPress with almost 100 sites. I need to set an option for a network-wide installed plugin but I don't want to go to each site dashboard to set this option by hand. How could I do ?

The option I want to change is a classic option, not a network-wide one. It comes from a plugin that I did not write. Want I need it to change the value of that classic option for all sites in my network at once.

4

Excuse me if I'm misunderstanding you, but aren't the functions add_site_option(), update_site_option() and get_site_option() pretty much, they fall back to single site functions, if not used in a multisite environment, only there for the purpose of having network-wide options.


Update:

Regarding your need to change a single site option for all sites in your network. Get all sites of the network with wp_get_sites(), which returns an array of arrays. You can use the array to loop through your single sites in your multisite installation. Make use of switch_to_blog() and restore_current_blog() while looping against the $blog_ids. In between the loop after switching and before restoring, use the single site options functions add_option(), update_option() and get_option() as needed.

  • 2
    +1. For more info wordpress.stackexchange.com/questions/181219/… – gmazzap Jul 20 '15 at 16:34
  • Sorry for not being clear enough. The option I want to change is a classic option, not a network-wide one. It comes from a plugin that I did not write. Want I need it to change the value of that classic option for all sites in my network at once. – Fabien Quatravaux Jul 23 '15 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.