I met the same problem before. I tried to use meta_query
parameter in the query argument, but didn’t succeed. The code I tried to use looks like this:
$software = array(
'post_type' => 'software',
'meta_query' => array('key' => 'legacy', 'value' => 1, 'compare' => '!=')
);
query_posts($software);
But the problem is this query also excludes posts that don’t have that meta key.
So I had to use a custom query, that gets all posts with legacy
meta key, and then excludes them:
global $wpdb;
$legacy = $wpdb->get_col("SELECT ID FROM $wpdb->postmeta WHERE meta_key='legacy'");
$software = array(
'post_type' => 'software',
'post__not_in' => $legacy
);
query_posts($software);
Hope this can help you.