0

Can only with SQL to that? I think with PHP I can do that, taking all product and then taking product with tag and compare those. But can I do that only in 1 line of code by SQL?

0

I'm going to answer my own question:

SELECT ID FROM wpyw_posts 
WHERE ID NOT IN (
    SELECT wpyw_term_relationships.object_id 
    FROM wpyw_term_relationships 
        INNER JOIN wpyw_term_taxonomy ON wpyw_term_taxonomy.term_id = wpyw_term_relationships.term_taxonomy_id 
    WHERE wpyw_term_taxonomy.taxonomy = 'product_tag'
) AND wpyw_posts.post_type = 'product'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.