0

I have to change my all 3000 published post status to draft. one way to do it one by one or another option is to select bulk post... but bulk selecting also takes a lot of time because I have around 3000+ posts. any easy way to do it? or any plugin? Thank You

1 Answer 1

1

If you have access to phpMyAdmin you can run this SQL query directly:

UPDATE {prefix}posts SET post_status="draft" WHERE post_status="publish"

If you do not have any experience with SQL queries then you should use this solution. Just place this code in functions.php and refresh the WordPress once, and it will be done.

function setPostsToDraft()
{
    global $wpdb;
    $qry = 'UPDATE '.$wpdb->prefix.'posts SET post_status="draft" WHERE post_status="publish"';
    $wpdb->query($qry);
}
setPostsToDraft();
1
  • 1
    Don't forget to do a complete DB backup before doing anything. Better to be safe than sorry. Nov 16, 2021 at 11:11

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.