Site icon Experience Wordpress Developer Online – Design Develop and Maintenance Support

Adding a View Comment Link in the WordPress Dashboard

Can you notice that For every wordpress post, page, custom post type, in the posts list there’s a link to view that specific post when you hover over the post title or page title, but there’s not a View Comment link in the comments list.

So, If you want to view comment link in the comment list of wordpress here is a code that you can use to add such link.

Add this code in your theme’s functions.php file of your active child theme (or theme). Save the file and refresh your dashboard. Go to Dashboard > Comments, hover over the content of a comment from that list and you will see the View Comment link after the Trash link.

function custom_view_comment_action( $actions ) {
global $comment;
 if ( $comment->comment_type !== '' ) {
        return $actions;
    }
$actions['view_comment'] = '<a title="View Comment" href="' . get_comment_link( $comment ) . '" target="_blank" rel="noopener">View Comment</a>';
return $actions;
}
add_filter( 'comment_row_actions', 'custom_view_comment_action' );
Exit mobile version