目前,为了对作者角色隐藏注释计数器,我编写了这样一个小代码
/*
* Hide Comments Counter for Author Hook
*/
if ( ! current_user_can( \'manage_options\' ) ) { add_filter(
\'comment_status_links\', function( $status_links )
{
// Override the original links:
$status_links[\'trash\'] = sprintf(
"<a href=%s>%s <span class=\'count\'></span></a>",
esc_url( admin_url( \'edit-comments.php?comment_status=trash\') ),
__( \'Trash\' )
);
$status_links[\'spam\'] = sprintf(
"<a href=%s>%s <span class=\'count\'></span></a>",
esc_url( admin_url( \'edit-comments.php?comment_status=spam\') ),
__( \'Spam\' )
);
$status_links[\'approved\'] = sprintf(
"<a href=%s>%s <span class=\'count\'></span></a>",
esc_url( admin_url( \'edit-comments.php?comment_status=approved\') ),
__( \'Approved\' )
);
$status_links[\'moderated\'] = sprintf(
"<a href=%s>%s <span class=\'count\'></span></a>",
esc_url( admin_url( \'edit-comments.php?comment_status=moderated\') ),
__( \'Pending\' )
);
$status_links[\'all\'] = sprintf(
"<a href=%s>%s <span class=\'count\'></span></a>",
esc_url( admin_url( \'edit-comments.php?comment_status=all\') ),
__( \'All\' )
);
return $status_links;
} ); }
if ( ! current_user_can( \'manage_options\' ) ) { add_action(\'admin_menu\',
\'hide_notification_bubble_in_admin_menu\'); }
function hide_notification_bubble_in_admin_menu() {
global $menu;
// Override the original links:
$menu[25][0] = sprintf( __( \'Comments %s\' ), \'\' );
}