WordPress.org

Support

Support » How-To and Troubleshooting » Query_posts without a custom field

Query_posts without a custom field

  • djhsecondnature
    Member

    @djhsecondnature

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query_posts without a custom field’ is closed to new replies.