• Resolved kraftomatic

    (@kraftomatic)


    Hello All,

    I’m looking for help with a query. I’m trying to select posts that do not have any “tag” values. I would assume checking for any tagged value of null specifically would work. The query format would be something like this initially:

    $querystr = "
        SELECT wposts.*
        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
        WHERE wposts.ID = wpostmeta.post_id
        AND wpostmeta.meta_key = 'tag'
        AND wpostmeta.meta_value = 'email'
        AND wposts.post_status = 'publish'
        AND wposts.post_type = 'post'
        AND wposts.post_date < NOW()
        ORDER BY wposts.post_date DESC
     ";

    I’m guessing it would be something similar to “AND wpostmeta.meta_key = ‘tag’ “, but I can’t find the exact syntax.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help With Post Query – identify all posts with no tags’ is closed to new replies.