I have a problem. I'm trying to exclude categories by there term meta. In my date base table I have
meta_id | term_id | meta_key | meta_value |
---------------------------------------------------------
1 | 12 | term_category_realized | 1
---------------------------------------------------------
2 | 20 | term_category_realized | 2
I'm setting up my args like this:
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'ID',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'term_category_realized',
'value' => 1,
'compare' => '!='
)
)
);
?>
and I get no result in the query. Whenever I change the 1
to 2
I get one result. Why is this not working with meta_value 1?
the foreach loop I use to output the results
echo '<ul class="realized-projects-category-list">';
foreach($categories as $category) {
echo '<li>';
echo '<a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
echo '</li>';
}
echo '</ul>';
UPDATE I have added some more categories. The problem occurs only to the term_id 20. Other categories are shown.