Multisite – Retrieve the same theme option from all sites of the network

may be its a late reply, but i hope this code will help you and anothers to solve this problem.

 <?php
  global $wpdb;
  $blogs = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' AND blog_id != 1 ");

  $sites = array();

 foreach ($blogs as $blog) {

 $sites[$blog->blog_id] = get_blog_option($blog->blog_id, 'nhp_opts');

}
  ?>

now you can use img tag and loop through this to get your option, for a purpose the current site option is omitted from sql, if you want to include current site in your result as well you can ignore AND blog_id != 1 this line from sql.

I hope this will help others as well.

Leave a Comment