برای نمایش کامنتهای یک کاربر با استفاده از یک ارایه شرطها را تعیین کردم و بعد از اون به تابع get_comments پاس دادم .
public function index()
{
$current_user = wp_get_current_user();
//تعین هر شرطی در کد پایین
$args = array(
'user_id' => $current_user->ID, // use user_id
'comment_approved' => '1',
);
$params =
[
'current_user' => $current_user,
'user_posts_count' => count_user_posts($current_user->ID),
'user_comments_count' => count(get_comments($args)),// ارایه args را به این تابع پاس دادم و با تابع count تعداد را بدست میاوریم
];
View::load('panel.dashboard.index',$params);
}
امید وارم که مفید واقع شده باشه.