How can I specify in my posts query that I only want to have posts without any tags at all? Pretty simple question, don’t think I need to elaborate much more than this.
So to get posts WITH a tag I would do query_posts('tag=this')
.
How can I specify in my posts query that I only want to have posts without any tags at all? Pretty simple question, don’t think I need to elaborate much more than this.
So to get posts WITH a tag I would do query_posts('tag=this')
.
You must be logged in to post a comment.
Use
tag__not_in(/* array of tag id values */)
.If you wanted to exclude all tags, you would need to build up an array using the full list of tags retrieved using
get_tags()
. That method will return an array of tag objects, where theterm_id
property is the id for that tag. Example:For more info on query parameters, see here.