Get current user comments with post
方法一、使用WP_Comment_Query():
取當前使用者評論及帖子
<?php $args = [ 'author__in' => get_current_user_id(), 'status' => 'approve', 'type' => 'comment', 'post_type' => 'post', ]; $user_comments = WP_Comment_Query($args); foreach($user_comments as &$comment){ $comment->comment_post = get_post($comment->comment_post_ID); //print_r($comment); echo $comment->comment_post->post_title.'<br/>'; }