Is there a way to query posts which do not have tags assigned to them?
query_posts('tag='tag_exmaple'&posts_per_page=-1');
Ty very much!
Either use the tag_not_in
parameter if you have the tag id and if not then you can use tax_query
parameter like so:
$tag_to_exclude = 'example_tag';
$args = array(
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => array($tag_to_exclude),
'operator' => 'NOT IN',
)
);
query_posts($args);
You could get an array of all of the tag ids and send it to the "tag__not_in" parameter. Not the most elegant solution, but I'm not sure how else it would be accomplished.