WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ) ORDER BY p.post_date DESC LIMIT 1' at line 9]
SELECT p.ID FROM wp_posts AS p WHERE p.post_date < '2017-10-07 18:14:04' AND p.post_type = 'post' AND p.post_status = 'publish' AND p.ID NOT IN ( SELECT tr.object_id FROM wp_term_relationships tr LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.term_id IN () ) ORDER BY p.post_date DESC LIMIT 1

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ) ORDER BY p.post_date ASC LIMIT 1' at line 9]
SELECT p.ID FROM wp_posts AS p WHERE p.post_date > '2017-10-07 18:14:04' AND p.post_type = 'post' AND p.post_status = 'publish' AND p.ID NOT IN ( SELECT tr.object_id FROM wp_term_relationships tr LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.term_id IN () ) ORDER BY p.post_date ASC LIMIT 1