To safely delete the 40K unused images that have been moved to Trash using WP-Optimize via SFTP, follow these steps:
- Access Your Server via SFTP:
- Use an SFTP client like FileZilla or Cyberduck to connect to your server.
- Navigate to the
wp-content/uploads
directory where WordPress stores media files.
- Locate the Trash Directory:
- Within the
uploads
directory, find the folder that WP-Optimize uses to store trashed images. This is typically a subdirectory named as wpo-unused-images
.
- Delete the Images:
- Select the images you want to delete. You can usually select all files in the directory and delete them in bulk.
- Database Cleanup:
- After deleting the images via SFTP, you need to clean up the database to remove references to the deleted images. This ensures that there are no orphaned records.
- Go to your WordPress admin panel, navigate to
WP-Optimize > Database
, and run the necessary optimizations.
- Ensure that any records related to the trashed images are also removed from the
wp_postmeta
, wp_posts
, and wp_options
tables if necessary.
- Backup Before Proceeding:
- Always take a full backup of your site, including the database and all files, before performing bulk deletions. This will help you restore the site if anything goes wrong.
- Verify the Cleanup:
- Check your Media Library and other parts of your site to ensure that the deleted images and their references have been removed successfully.
Following these steps will help you manage and clean up the large number of unused images efficiently while ensuring your database remains optimized and free of orphaned data.