I'm running a couple of custom queries on custom post templates, and can't figure out how to exclude a specific category from results.
In my database, in the wordpress_posts table, all the "post_category" fields are 0. However, the posts are in their own categories, and working right. So I'm not sure where the category gets saved.
I'm using this query:
$querystr = "
SELECT DISTINCT wordpress_posts.*
FROM $wpdb->posts wordpress_posts
WHERE wordpress_posts.post_content LIKE '%$first_name $last_name%'
AND wordpress_posts.post_status = 'publish'
AND wordpress_posts.post_type = 'post'
ORDER BY wordpress_posts.post_date DESC
I'm defining first_name and last_name from custom fields in WordPress.
I've tried:
$querystr = "
SELECT DISTINCT wordpress_posts.*
FROM $wpdb->posts wordpress_posts
WHERE wordpress_posts.post_content LIKE '%$first_name $last_name%'
AND wordpress_posts.post_category != '1302'
AND wordpress_posts.post_status = 'publish'
AND wordpress_posts.post_type = 'post'
ORDER BY wordpress_posts.post_date DESC
But that didn't work. Can someone point me in the right direction? (which, with my luck, is right in front of my face)