I am wondering how I can rework this statement to exclude a certain category, ie. category id = 14
Please note that the wordpress categories are in a different table.
referenced as term_relationships and the category is term_taxonomy_id
<?php
$now = gmdate("Y-m-d H:i:s", strtotime('0 days'));
$request = $wpdb->prepare("SELECT ID, post_title, post_date, post_excerpt,LEFT(post_content,$sqllimit) AS short_post_content FROM $wpdb->posts WHERE post_status = 'publish' ");
if($hide_pass_post) $request .= "AND post_password ='' ";
if($include_pages) $request .= "AND (post_type='post' OR post_type='
else $request .= "AND post_type='post' ";
$request .= "AND post_date_gmt > '$now' ORDER BY post_date ASC LIMIT $skip_posts, $returnnum";
$posts = $wpdb->get_results($request); ?>
1 Answer