During the operation of a WordPress website, when the host's disk space starts to fill up, but we don't intend to upgrade the hosting package for the time being, deleting media files that are no longer in use is an effective solution. In this article, we will explain how tomanually operatedor throughplug-in (software component)to delete unused WordPress media files in order toSave server storage spaceThe
Why delete unused media?
Media files, especially image files, take up a significant portion of space in a WordPress site. So deleting unused media files can:
- Free up server space: Reduce host storage costs and avoid problems caused by lack of space.
- Improve website performance: Reduce unnecessary file storage and increase the speed of your website.
- Keeping the media library tidy: Reducing redundant files makes website maintenance easier and faster.
Two ways to delete unused media
There are two main ways to delete unused media files in WordPress: manual deletion and bulk deletion via plugins. Both have their own advantages and disadvantages, manual deletion although the control is more detailed, but the operation is more cumbersome; while the plug-in deletion is more efficient, but need to be careful operation, to avoid accidentally deleting the media being used.
Option 1: Manually Delete Unused WordPress Media
Step 1: Login to WordPress Backend
move1: need to log into the backend of your WordPress site
Only users with administrator privileges or with the Delete Content and Media permission can perform this action.
Step 2: Access to the Media Library
After a successful login, go to the WordPress dashboard page. Next, navigate to the Media Library page to view all your uploaded media files.
- In the left menu bar, selectmedia libraryThe
- By default, the media library may be displayed in list view. To make it easier to browse and select files, it is recommended to switch to grid view.
Step 3: Filtering unused media
On the Media Library page, you can use the filtering tool to find unused media files.
- At the top of the Media Library page, click "All media items" drop-down list.
- In the filtering options, select "unattached", which will display those media files that have not been attached to any posts or pages.
Unattached media files usually mean that they are unused and can beConsider removing itThe
Step 4: Batch Selection and Deletion of Media
If you find a large number of unused media files, thebatchSelect the function to quickly perform the deletion operation.
- Click the top right corner of the media library page on "batch file selection"Button.
- Select the media files to be deleted, which can be done by clicking on the thumbnails of each file.
- Once the selection is complete, click on "permanent deletion"Button.
At this point, the selected unused media files will be completely deleted from the server.
caveat
A common problem with manual deletion is that if you have a large number of media files, manually selecting and deleting them can beconsume a lot of time. Some media are not shown as attached, but they may actually be on certain pagesCalled via shortcode or custom fieldPlease be careful before deleting.
Option 2: Remove unused WordPress media using a plugin
If there are too many media files on your website, deleting them manually may seem too tedious. In this case, using a plugin to bulk clean unused media files is an efficient option. Here is how to use the pluginMedia Cleanerto remove the steps for unused media.
Step 1: Install and activate Media Cleaner plugin
Media Cleaner can help you scan and remove unused media files. First, you need to install and activate it from the plugin repository.
- Log in to the WordPress backend and navigate to thePlugins > Install New PluginThe
- Type "Media Cleaner" in the search box.
- Once you have found the plugin, click "mounting" button, followed by clicking on the "activate".
Step 2: Go to the Media Cleanup Tool
After the plugin is installed and activated, a new menu item is seen "Media > Cleaner". Click on this option to go to the Media Cleaner plugin's interface.
Step 3: Scanning for unused media
The Media Cleaner interface allows you to scan websites for unused media.
- Click "scanning" button. The plugin will automatically scan all the uploaded media files to find out the ones that are not used by any post, page or widget.
- Note that some media files, although not shown as being used, may actually still be used by theShortcodes, themes or plugins to use, so it needs to be scrutinized carefully after scanning is complete.
Step 4: Batch select and delete unused media
When the scan is complete, you will see a list of all unused media.
- Click on "unanimous" option, all scanned unused media will be automatically selected.
- Then, click on "Delete all" button, the plugin will delete all selected unused media files.
Step 5: Check the results
Once the deletion is complete, it is recommended that you check the front-end pages of your website again to ensure that all images, videos, and other media files still in use areCan be displayed normally. If you find a case of mistaken deletion, you can find and recover partially deleted files through the plugin's trash.
caveat
- choose carefully: The Media Cleaner plugin, while very powerful, needs to be used with special care, especially if your site uses a lot of custom code, shortcodes, or plugins, and certain media files may not show up as attached, but are still being used in certain places.
- Backup Sites: It is recommended to backup your website before performing a mass deletion operation to prevent accidental deletion of important media files.
reach a verdict
With the detailed tutorial in this article, you can choose to delete unused WordPress media files either manually or by using a plugin. Whether you wish to manually clean them up one by one or need to achieve bulk deletion through a plugin, both of the above methods can help you effectively reduce disk space usage and improve your website's performance and storage management efficiency.