WordPress.org

Ready to get started?Download WordPress

Forums

Meta Query for posts with a meta key not set (1 post)

  1. grosbouff
    Member
    Posted 2 years ago #

    Hi, how can I do fetch posts for which a custom meta key is NOT set ? (like in ticket : http://core.trac.wordpress.org/ticket/18158) ?

    I did try with the parameter

    'meta_query' => array(
    				array(
    					'key' => $this->meta_key,
    					'meta_compare'=>'!=',
    					'meta_value'=>'true'
    				)
    			)

    But it's not workind, and also with the 'posts_where' filter

    $where .= " AND {$wpdb->postmeta}.meta_key!='{$this->meta_key}'";

    not working either.. Thanks !

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags