Get all comments of author's posts
Hello I have multi author website. I want to display all comments of posts created by author in author page. Please help me. I found this code but fatal error
?php
$args = array(
'author' = AUTHOR_ID,
'posts_per_page' = 500, //Don't use -1 here
);
$the_query = new WP_Query( $args );
if($the_query-have_posts() ) : ?
?php while ( $the_query-have_posts() ) : ?
?php
$nested_args = array(
'post_id' = get_the_ID()
);
$comments_query = new WP_Comment_Query;
$comments = $comments_query-query( $nested_args );
if ( $comments ) {
foreach ( $comments as $comment ) {
echo 'p' . $comment-comment_content . '/p';
}
}
?php endwhile; ?
?php endif; ?
?php wp_reset_query(); ?