Problem Select wordpress posts with given text string and add a custom field to them?
Hey guys.. I made this SQL query which selects post Ids by all posts containing a keyword then attempts to add a custom field but I get a syntax error.
Bit lost so all help appreciated thanks.
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT ID FROM wp_posts WHERE post_content LIKE '%Customer Reviews%' AS post_id,
'customer_reviews' AS meta_key,
'On_or_delete' AS meta_value
WHERE ID NOT IN
WHERE meta_key = 'customer_reviews')
AND post_type = 'post';