Yes, there is a hook you can use to filter the action links: comment_row_actions
. E.g.
add_filter( 'comment_row_actions', 'my_comment_row_actions', 10, 2 );
function my_comment_row_actions( $actions, $comment ) {
// Filter the actions by user role.
$roles = (array) wp_get_current_user()->roles;
if ( in_array( 'administrator', $roles ) ) {
$actions['foo'] = '<a href="#">Foo action</a>';
}
// Filter the actions by user caps.
if ( ! current_user_can( 'custom_cap' ) ) {
unset( $actions['approve'] );
}
return $actions;
}
But the above hook only allows you to filter the action links, i.e. the items in the actions array ($actions
). To actually allow/disallow the user from executing the actual action (approving or unapproving a comment, marking it as a spam, trashing the comment, etc.), you will need a different hook or approach, depending on the action you wish to remove/disable.