How to display a user’s total comment count on WordPress

Put below code to your template and it will display the total comment count of user.

	global $wpdb, $post, $current_user;
	$userId = $current_user->ID;
	$where = 'WHERE comment_approved = 1 AND user_id = ' . $userId ;
	$comment_count = $wpdb->get_var("SELECT COUNT( * ) AS total FROM {$wpdb->comments}{$where}");
	echo 'Comments: <strong>' . $comment_count . '</strong>';

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us