Custom Select Query by meta key and cat id
-
Hi I have this custom query that get the expiry date of the post and orders post by that. How do I amend it to only list from a certain category id e.g. ’20’
$querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'es_ape_expiry' ORDER BY wpostmeta.meta_value ASC "; $pageposts = $wpdb->get_results($querystr, OBJECT);
many thanks
- The topic ‘Custom Select Query by meta key and cat id’ is closed to new replies.