When creating an article or page, you might decide to discard or discontinue some of them, and those items will end up in the trash category.
If you want to save hosting disk space, you can automatically set how long trash items are kept in WordPress for you.
The method for setting the trash retention period in WordPress that we will discuss here does not use any additional plugins, so you do not need to add a plugin specifically for automatic trash cleanup.
Prerequisites for Setting the Trash Retention Period in WordPress
- Basic WordPress file editing
- Ability to edit thewp-config.php file, whether through hosting, VPS, console, or file explorer on localhost.
How to Set the Trash Retention Period in WordPress
Before we go further, I will add the code via cPanel here. If you are not using cPanel, you can adjust this using the file manager on the panel you are using. Additionally, by default, trash files are automatically deleted from the website in 30 days, so if you want to keep trash files for 30 days, you do not need to make any changes.
- First, log in to your cPanel. cPanel login details are usually sent to your registered email after the service is active.
- Find and open theFile Manager
- page. Open your WordPress installation folder. Usually, if WordPress is installed on the main domain on your hosting, the installation folder is in thepublic_html
- folder. Find and edit thewp-config.php
- file. Add the following line above the line /* That’s all, stop editing! Happy publishing. */
//Auto delete trash itemdefine('EMPTY_TRASH_DAYS', 1 ); //Ubah integer (1) menjadi jumlah hari berkas sampah disimpan
COMMENTS
Loading...