I need help putting together an SQL that can delete users if they don't have (metakey1 or metakey2) and (does not have comments)
I have this SQL which does it for single meta_key
SELECT *
FROM wp_users LEFT JOIN wp_usermeta
ON wp_users.ID = wp_usermeta.user_id
AND wp_usermeta.meta_key = 'metakey1'
WHERE wp_usermeta.user_id IS NULL
How can i extend the above SQL to do that?
get_user_meta
andWP_User_Query
? What you're wanting to do is going to result in a super expensive/slow query that probably won't finish in the time limit PHP has, and cause many issues ( assuming it can be understood ). Additionally, can you provide some context? What problem does this solve for you? – Tom J Nowell♦ Mar 13 '19 at 1:27