I want to exclude some posts from the home page. So I want to use meta data, and filter all posts that are signed by meta_value=0.
Like this:
$args = array(
'posts_per_page'=>28,
'meta_query' => array(
array(
'key' => 'show_on_home',
'value' => '0',
'compare' => 'NOT LIKE'
)
)
);
$query = new WP_Query( $args );
So, if I sign some post with meta_key=0 it will not apear.
The problem is that I have a lot off posts that don’t have meta data at all, and I don’t want to filter them.
WordPress 3.5 and up supports
EXISTS
andNOT EXISTS
comparison operators.So…
… should show all posts that don’t have that key. I think that is what you are trying to do.