1

I'm seeing a SQL error in my log file that reads like this:

[15-Oct-2016 17:34:59 UTC] WordPress database error You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the right syntax to use near 
'WHERE  AND comment_parent IN (10)  ORDER BY comment_date_gmt ASC, comment_ID ASC' 
at line 1 for query 
SELECT wp_comments.comment_ID, wp_comments.comment_parent  
WHERE  AND comment_parent IN (10) ORDER BY comment_date_gmt ASC, comment_ID ASC 
made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), 
include('/themes/smb/single.php'), comments_template, 
WP_Comment_Query->__construct, WP_Comment_Query->query, 
WP_Comment_Query->get_comments, WP_Comment_Query->fill_descendants

The error occurs on a post that does have child comments, and our theme does show those in nested fashion, but very generically, using the wp_list_comments function. The theme isn't using any special hooks, or any other tricks I can see.

Googling for this error, I see it show up on other people's blogs (where it is getting inserted into the output page! At least on my site I don't see that), so I know this isn't unique to our site.

So the question is: does anybody know what produces this error, and how to fix it?

We're on Wordpress 4.6.1 and the theme is custom built.

1

It looks like this is a bug related to caching in WordPress v4.6.1 which you can follow on Trac ticket #37696. A proper fix is scheduled for WordPress v4.6.2, but in the meantime, you could try the following workaround reported by Rarst, who created the issue on Trac:

Issue goes away if I disable Object Cache (Siteground's Memcached).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.