I have this query to get posts with custom field, which works perfectly.
<?php query_posts('meta_key=version&meta_value=one'); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
// my posts displaying
Now I wants to get posts which does not have meta_value to ‘one’ or does not have version meta_key set. I tried with empty strings ‘meta_key=&meta_value= ‘ but it return all posts including which has meta_value to ‘one’.
Thanks for any help
Use
$the_query = WP_Query($params). It returns a query object that can be used like so:-further information on what operators you can use here