I see the following error on my Wordpress Posts page when I enable debugging. I only noticed this when I started adding categories to my posts and they were not saving. I never used categories before, so I am not sure how long this issue has existed. I have switched the theme and disabled all plugins and still see the issue.

The error is preventing post categories from being displayed. For some reason, WP is building this SQL query with improper syntax and I can't figure out why.

[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 ') ORDER BY t.name ASC' at line 1]

SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t 
INNER JOIN wp_term_taxonomy AS tt 
ON t.term_id = tt.term_id 
INNER JOIN wp_term_relationships AS tr 
ON tr.term_taxonomy_id = tt.term_taxonomy_id 
WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format', 'yst_prominent_words') 
AND tr.object_id IN (1461, 1475, 1539, 1605, 1708, 1732, 1760, 1764, 2292, 2311, 2343, 2368, 2374, 2380) 
AND t.term_id NOT IN() ORDER BY t.name ASC
  • The error is with AND t.term_id NOT IN(). In what context is this error displaying? Are you editing a post? Is this in a custom query? – MikeNGarrett Mar 20 at 22:24

Your Answer

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

Browse other questions tagged or ask your own question.