Advertisement
daymobrew

Add Updates menu when plugin updates available

Jul 15th, 2014
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. // In response to post at:
  2. // http://wptavern.com/a-proposed-enhancement-that-saves-a-mouse-click-when-upgrading-wordpress-plugins
  3. add_action('admin_menu', 'add_plugin_updates_menu');
  4. function add_plugin_updates_menu() {
  5.   $update_data = wp_get_update_data();
  6.  
  7.   // Add "Updates" menu item when plugin updates available.
  8.   if($update_data['counts']['plugins'] > 0) {
  9.     add_plugins_page( 'Not displayed', 'Updates', 'update_plugins', 'plugins.php?plugin_status=upgrade');
  10.   }
  11.  
  12.   // Add "Pending" menu item when there are comments awaiting moderation.
  13.   $awaiting_mod = wp_count_comments();
  14.   $awaiting_mod = $awaiting_mod->moderated;
  15.   if($awaiting_mod) {
  16.     add_comments_page( 'Not displayed', 'Pending', 'moderate_comments', 'edit-comments.php?comment_status=moderated');
  17.   }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement