Do NOT use query_posts()
– it is bad, very bad to be exact.
For more information read:
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
Use WP_Query
instead.
Example with meta_key
, meta_value
and meta_compare
parameters in use:
$args = array(
'meta_key' => 'clpr_excoupon',
'meta_value' => '0',
'meta_compare' => '!='
);
$query = new WP_Query( $args );
Note: those parameters work for query_posts
too, but as said, you shouldn’t use it.
Update:
With NOT EXISTS
compare.
$args = array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'clpr_excoupon',
'compare' => 'NOT EXISTS',
'value' => 'prior to WP 3.9 a value was needed due to bug #23268'
),
array(
'key' => 'clpr_excoupon',
'compare' => '!=',
'value' => '0'
),
),
);
$query = new WP_Query( $args );