I’d like to run a query through my WordPress database that updates the blog_public values on all individual sites. I’m stuck on how to have the statement look for wp_2_options, wp_3_options, etc.
I can do it individually with something like this:
UPDATE wp_10_options
SET option_value = REPLACE(option_value, '1', '0')
But am stuck on how to run a query that would go across all the tables. Any help?
Thanks in advance 🙂
Got a partial solution, but requires VPS to run it as shared hosting has a restriction on what you can do with a cursor.
Anyway,
You run it in your sql query window to create the procedure. It’ll then stick around until you need it.
To use it do:
To change all options with the name blog_public in the wpglobal database to 1. PHP would probably be much much easier, eh? Or so say my colleagues who came up with the above 🙂
There are probably plenty of approaches to this from database perspective… But if this only needs to be done once and sticking to WP APIs: