Advertisement
daymobrew

Change Comments number link

Jul 18th, 2014
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. // Solution for http://wptavern.com/a-proposed-enhancement-that-saves-a-mouse-click-when-upgrading-wordpress-plugins#comment-56798
  2. add_filter('add_menu_classes', 'um_add_clickable_numbers');
  3. function um_add_clickable_numbers($menu) {
  4.   foreach ($menu as $key => $menu_item) {
  5.     if (strpos($menu_item, 'Comments ') == 0) {
  6.       $re = "/(Comments) (.*)$/";
  7.       $subst = '$1</a> <a href="edit-comments.php?comment_status=moderated">$2';
  8.       $menu[$key][0] = preg_replace($re, $subst, $menu[$key][0], 1);
  9.     }
  10.   }
  11.  
  12.   return $menu;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement