Skip to content

Instantly share code, notes, and snippets.

@tradesouthwest
Created September 27, 2018 03:27
Show Gist options
  • Save tradesouthwest/1ba56633492fbc4e32bad127c8f58999 to your computer and use it in GitHub Desktop.
Save tradesouthwest/1ba56633492fbc4e32bad127c8f58999 to your computer and use it in GitHub Desktop.
<?php
/**
* Get all blog ids of blogs in the current network that are:
* - not archived
* - not spam
* - not deleted
*
*
* @return array|false The blog ids, false if no matches.
*/
private static function get_blog_ids() {
global $wpdb;
// get an array of blog ids
$sql = "SELECT blog_id FROM $wpdb->blogs
WHERE archived = '0' AND spam = '0'
AND deleted = '0'";
return $wpdb->get_col( $sql );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment