-
-
Save JEverhart383/60bf60ed423d11b97be6 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Abandoned WP Plugin | |
| * Plugin URI: https://gist.github.com/woodwardtw/cf706545a064a02fbd60 | |
| * Description: This plugin finds abandoned WP site (by last update) on a WP MU installation and provides links to WP site and mailto | |
| * Version: 1.0.0 | |
| * Author: Tom Woodward (og script), Jeff Everhart(plugin shell and implementation) | |
| * Author URI: https://gist.github.com/woodwardtw/cf706545a064a02fbd60 | |
| * License: GPL2 | |
| */ | |
| add_action( 'network_admin_menu', 'create_abandoned_menu' ); | |
| function create_abandoned_menu(){ | |
| add_menu_page('Abandoned Sites', 'Abandoned Sites', 'manage_network', 'abandoned-sites', 'get_abandoned' ); | |
| } | |
| function get_abandoned(){ | |
| 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