Title: Plugin doesn&#8217;t work because have_comments returns false
Last modified: January 7, 2019

---

# Plugin doesn’t work because have_comments returns false

 *  Resolved [Firas](https://wordpress.org/support/users/firas/)
 * (@firas)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-because-have_comments-returns-false/)
 * Hi,
 * The plugin wasn’t working on our site. Upon investigation it turns out that have_comments(
   on line 236 of class-llc-public.php) was returning false even though we had comments.
   I replaced it with get_comments_number:
 * `} elseif ( ! ( get_comments_number() > 0 || 'open' == $post->comment_status )){`
 * And now it works.
 * The codex says of have_comments:
 * > Warning: this function will always return “false” until after comments_template
   > has been called. If you need to check for comments before calling comments_template,
   > use get_comments_number instead.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Joel James](https://wordpress.org/support/users/joelcj91/)
 * (@joelcj91)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-because-have_comments-returns-false/#post-11107440)
 * Thanks, [@firas](https://wordpress.org/support/users/firas/). Fixed in the latest
   version.

Viewing 1 replies (of 1 total)

The topic ‘Plugin doesn’t work because have_comments returns false’ is closed to
new replies.

 * ![](https://ps.w.org/lazy-load-for-comments/assets/icon.svg?rev=3548143)
 * [Lazy Load for Comments](https://wordpress.org/plugins/lazy-load-for-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/lazy-load-for-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/lazy-load-for-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/lazy-load-for-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lazy-load-for-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lazy-load-for-comments/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Joel James](https://wordpress.org/support/users/joelcj91/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-because-have_comments-returns-false/#post-11107440)
 * Status: resolved