I’ve created a custom field called ‘Snippet’ (and have created three different values, each post can belong to one of these three values) which I’ve applied to certain posts/news items (just the small news items on my site). I’ve got all these snippets to appear in my side bar using the excellent ‘Query Posts’ plugin.
I don’t want any of these posts to appear in the main loop however and I’m struggling to work out how to do this. Can you filter out posts by using custom fields? I tried the below (in bold) but it didn’t work:
$the_query = new WP_Query(‘meta_key=-Snippet&cat=-‘. $ex_feat . ‘,-‘ . $ex_vid . ‘,-‘ . $ex_aside . ‘&showposts=’ . $showposts . ‘&orderby=post_date&order=desc’);
Am I going about this the correct way?
- The topic ‘Can I Exclude Posts with Custom Field Names/Values?’ is closed to new replies.