Forums
Home / Fixing WordPress / Query_posts without a custom field
(@djhsecondnature)
12 years, 7 months ago
I’m trying to select posts without a particular custom field. Some posts will have it, some won’t, I want to grab just the ones that do not have it.
Something like this:
$args = array( 'meta_query' => array( array( 'key' => '$customfield', 'value' => NULL, 'compare' => '=' ) ) );
But not that, as that doesn’t work.
Anyone have any ideas?
12 years, 6 months ago
*bump*
(@esmi)
'meta_value' => '_wp_zero_value'? http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters
'meta_value' => '_wp_zero_value'