0

The following code updates the post status of standard wordpress posts to 'Archived'.

UPDATE wp_posts SET post_status = 'Archived' WHERE post_status != 'static';

How can I make this only affect custom post types with the slug of 'cpt_operator'. I know I can do this from Wp-Admin but with over 2,500 posts its a huge task.

1 Answer 1

2

If you mean post type instead of slug I'd say...

UPDATE wp_posts
SET post_status = 'archived'
WHERE post_status <> 'static'
AND post_type = 'cpt_operator';

But be careful when editing the db directly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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