Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Last active March 3, 2016 19:17
Show Gist options
  • Save woodwardtw/cf706545a064a02fbd60 to your computer and use it in GitHub Desktop.
Save woodwardtw/cf706545a064a02fbd60 to your computer and use it in GitHub Desktop.
wordpress multisite query to get the 50 blogs that have gone the longest without being updated
<?php
global $wpdb;
$results = $wpdb->get_results( 'SELECT * FROM wp_blogs ORDER BY last_updated ASC LIMIT 50', ARRAY_A);//change how many you want back here
//var_dump($results);
echo '<table>';
foreach ( $results as $site )
{
echo '<tr><td>' .
get_blog_option( $site['blog_id'], "blogname") .
'</td><td> ' . $site['last_updated'] .
'</td><td><A HREF="' . get_blog_option( $site['blog_id'], "siteurl") .
'">LINK</A></td><td><a href="mailto:'.get_blog_option( $site['blog_id'], "admin_email") .
'?Subject=doom" target="_top">email '. get_blog_option( $site['blog_id'], "admin_email") .
'</a></td></tr>';
}
echo '</table>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment