paginate_comments_links() not working
I'm using paginate_comments_links() to get all the comments by the current user:
?php
global $current_user;
get_currentuserinfo();
$userid = $current_user-ID;
$args = array(
'user_id' = $userid,
'number' = 2,
);
$comments = get_comments($args);
foreach($comments as $comment) :
echo('br /' . $comment-comment_date . 'br /' . $comment-comment_content);
endforeach;
paginate_comments_links();
?
However, the pagination is not showing up. I have posted 7 comments, so I expected to see 2 comments per page, 4 pages in total. However, no pagination is showing up at all.
Turning on errors in php reveals: Notice: Undefined property: WP_Query::$comments in /wp-includes/comment.php on line 788
Where am I going wrong?
Topic paginate-comments-links pagination comments Wordpress
Category Web