WordPress.org

Ready to get started?Download WordPress

Forums

If post is ONLY tagged with one tag... (2 posts)

  1. jps0611
    Member
    Posted 3 years ago #

    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

  2. vtxyzzy
    Member
    Posted 3 years ago #

    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'.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags