I have small problem, I have author page (example.com/author/joe
) on this page I have listed all author comments with pagination but pagination doesn't work after click url is - example.com/author/joe/page/2 and page is redirect to index.php.
In other loops it works, just have problem with author page.
Any ideas ?
CODE:
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $number = get_option('comments_per_page'); $offset = ( $paged - 1 ) * $number; $count = count( get_comments( array( 'user_id' => $user_ID, 'status' => 'approve', ) ) ); $max_total = ceil($count/$number); $args = array( 'user_id' => $user_ID, 'number' => $number, 'status' => 'approve', 'offset' => $offset, 'paged' => $paged ); $the_query = new WP_Comment_Query; $comments = $the_query->query( $args ); foreach($comments as $comment){ //code } //Pagination $big = 999999999; echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $max_total, 'prev_next'=> true, ) );