Comments not shown in wordpress – wp_list_comments(), comments_form()
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Comments not shown in wordpress – wp_list_comments(), comments_form()’ is closed to new replies.
The topic ‘Comments not shown in wordpress – wp_list_comments(), comments_form()’ is closed to new replies.
(@imads)
9 years, 10 months ago
In 90% of the cases, that is refreshing the same page, functions wp_list_comments(), comments_form(), has_comments() and other functions alike aren’t yielding the expected results.
So I refresh the same page and these functions return different results, for example either 0 comments, 5 or 21 comments, while no other user is using the database since it’s a test system with XAMPP. It’s noticeable that only values 0, 5 and 21 seem to pop up for the numer of comments.
Looking further down the call stack I could notice that sometimes $wpdb->has_comments() returns 0 although the post contains comments.
I suspect this may be something related to wordpress caching system of my version 4.5 and the only issue I found on their bug tracker was related to including wp_list_comments() twice in the same file, which is not the case. Updating to latest version also does not solve this.
I have noticed that the below debug log was printed in the debug.log file, but only once although the page has been reloaded hundreds of times:
Issue occurs on multiple self-hosted wordpress installations.
With other themes, like twentysixteen or others I don’t see this sort of behavior, so it’s definitely something wrong on my side and I suspect the caching configuration, which I didn’t touch.
Also, I’ve checked for wp_reset_postdata() usage and there’s none in my single template, nor is it included somewhere above. Add theme support is used for comments and everything. Any hint or some direction in which I should dig further would be great!