Is there a way I can access the wp_options table of all the child sites? I want to create a multisite plugin that can be setup at the network level and will populate the child site plugins with defaults that can then be overwritten by the each individual site. I'm aware that I could read/write from wp_sitemeta this way, but in my instance, it would make sense if I could access the other "local" tables. I could probably write a custom query using the WP query function, but I was wondering if there was a better way?

2 Answers 2


Try get_blog_option(). It does not use switch_to_blog(), and so introduces much less overhead. https://codex.wordpress.org/Function_Reference/get_blog_option

  • Is there a function for writing options, too? And is there a function for retrieving all ID's for all sites?
    – NightHawk
    Commented Mar 29, 2012 at 19:57
  • update_blog_option(). I don't think there's a WP function for getting all site ids. Try: global $wpdb; $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs" ) ); Commented Mar 29, 2012 at 20:48

Try switch_to_blog and restore_current_blog.

Both functions are quite expensive, you may wish to implement only small parts of their functionality, like changing the prefix of $wpdb.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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