This simple function will return an array of the various WordPress multisite options table names that exist in the WordPress database. For example, this function will return an array that looks like:
Array
(
[0] => wp_options
[1] => wp_2_options
[2] => wp_3_options
[3] => wp_6_options
[4] => wp_9_options
[5] => wp_11_options
[6] => wp_12_options
[7] => wp_14_options
[8] => wp_17_options
[9] => wp_19_options
)
[php]function get_ms_options_tables() {
global $wpdb;
$query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
$query .= " ORDER BY {$wpdb->blogs}.blog_id ";
$order = "ASC";
$query .= $order;
$sql = $wpdb->prepare($query);
$blogs = $wpdb->get_results( $sql, ARRAY_A );
//$blogs = $this->get_ms_sites();
foreach ($blogs as $blog) {
$tables[] = $wpdb->get_blog_prefix($blog['blog_id']).'options';
}
return $tables;
}[/php]
Nicolae Gabriel says
These are all the options :
$all_options = wp_load_alloptions();