Support » Fixing WordPress » If post is ONLY tagged with one tag…

  • Howdy folks, first post!

    I’m trying to modify my WP_Query() to filter out any post tagged with ONLY ‘canada’. If it’s tagged with ‘canada’ and something else, ‘canada’ + ‘music’, it can stay.

    Any ideas how to determine if a post is ONLY tagged with a single tag?

    Thanks!

    JPS

Viewing 1 replies (of 1 total)
  • Use the function get_the_tags() to retrieve an array of the tags for the post. Then, check that the array has only one element and that the element is named ‘canada’.

Viewing 1 replies (of 1 total)
  • The topic ‘If post is ONLY tagged with one tag…’ is closed to new replies.