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 'AND
p.ID = object_id
AND
p.post_status = 'publish' at line 14]
SELECT
ID
FROM
wp_posts p,
wp_terms t,
wp_term_taxonomy x,
wp_term_relationships r
WHERE
t.term_id = x.term_id
AND
r.term_taxonomy_id = x.term_taxonomy_id
AND
ID <>
AND
p.ID = object_id
AND
p.post_status = 'publish'
AND post_type = 'post' AND ID NOT IN(3155) AND x.term_id IN(7,10,11)

