I want to bulk add a custom field (category) with value (photography) to all posts in a specific category (photography, with Category ID 5).
I have used the code below to bulk add a custom field to all posts, but how can I narrow this down to a specific category? Anyone?
This is the code I used for all posts:
INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT wp_posts.ID, 'category', 'photography' FROM wp_posts WHERE wp_posts.post_status = 'publish'