WordPress query to select a post that belongs to two categories

WordPress Plugins and good code samples

November 2007

$q = ‘ SELECT post_id FROM wp_post2cat a WHERE a.post_id in ( select b.post_id FROM wp_post2cat b where category_id = 9 ) and category_id = ‘. $cat[1]->cat_ID .’ ‘;