Hi there, I'm working with this SQL query:
$posts = $wpdb->get_results("SELECT ID, post_title FROM " . $wpdb->posts . " WHERE post_status='publish' ORDER BY post_date DESC LIMIT " . $limit);
problem is my SQL skills are not good enough for me to figure out how to modify this query to not return any posts that are included in category '31'.
What I have done, is put a another query, within the loop I've made, that looks up that categories of each post as it loops through, and skips the loop if one of the categories is '31'.
The problem that the out loop's query has the LIMIT statement, to always deliver X number of posts. But obviously I'm always getting X posts minus how many posts in the query are Category 31.
Is there a way to do this filtering in a single SQL statement?
Thanks in advance for any help you can offer.