crsneilhedley
Member
Posted 13 years ago #
In trying to search through my tables for another series of hacks I've come up with, I'm finding that I'm probably doing a TON of wasteful queries - in part because I'm using the Multi-DB plugin, but in part because the data for the searches I need is spread across a couple of tables.
The whole thing could be streamlined in a BIG way if I could simply add a field to the wp_blogs table, namely "blogname", which would take it's info from the wp_options table as option_id 3 (at least in MY setup).
Has this either been done (and I just couldn't find it), or is there a good reason why I *shouldn't* do it?
Thanks.
-- Neil
You could use the switch_to_blog function and pull the blogname from the $wpdb variable. You could even put the switch_to_blog in a loop and give it a range of blog_ids.
crsneilhedley
Member
Posted 13 years ago #
@tmoorewp
Yowza... didn't know it was that easy (it IS easy, yes?)
Will do some research on exactly how to do what you're suggesting, as it's a function I'm not familiar with.
Thanks!
Either that or get_blog_option($blogid,'blogname').
I think that's it.
Reference: http://codex.wordpress.org/WPMU_Functions/get_blog_option
crsneilhedley
Member
Posted 13 years ago #
Hmmm... this thread...
http://mu.wordpress.org/forums/topic/15951?replies=10
...seems to suggest that the overhead from using switch_to_blog makes the current brute-force method of pulling out info seem lighter in comparison. Will keep looking though - thanks!
crsneilhedley
Member
Posted 13 years ago #
@tdjcbe -
You might have nailed it. THANK you!
I'll let you know, for posterity, how I make out with it.
... will get_blog_option play nice with Multi-DB?
get_blog_option should work wtih Multi-DB, since Multi-DB is supposed to be transparent to WordPress functions.