EDIT: Updated function to use get_comments offset param. Issue is still occurring.
I am displaying 5 comments at the end of an article and using ajax to request the rest of the comments. On this page, http://www.universityaffairs.ca/opinion/in-my-opinion/phd-studies-in-canada-a-dilemma-for-international-students/#comments
the comment by Joshan Rodrigues is a reply to another comment. This is fine.
When I load the rest of the comments through ajax by clicking the More Comments link, Joshan Rodrigues' comment appears again at the end of the list, even if the comment date is older. Give it a try.
Below is function called by ajax.
function get_more_comments() {
global $wpdb; // this is how you get access to the database
$comments = get_comments(
array(
'post_id' => $_REQUEST['post_id'],
'status' => 'approve',
'order' => 'ASC',
'offset' => 5,
'number' => 1000
)
);
echo '<ol class="commentlist">';
wp_list_comments(
array(
'avatar_size' => 0,
'walker' => new Walker_Comment_custom(),
),
$comments
);
echo '</ol>';
die();
}
Any idea why this is happening?