{"id":13369,"date":"2026-06-18T05:46:04","date_gmt":"2026-06-18T05:46:04","guid":{"rendered":"https:\/\/www.webystrata.com\/blog\/?p=13369"},"modified":"2026-06-18T05:46:04","modified_gmt":"2026-06-18T05:46:04","slug":"automatically-delete-trash-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.webystrata.com\/blog\/automatically-delete-trash-in-wordpress\/","title":{"rendered":"How To Automatically Delete Trash In WordPress"},"content":{"rendered":"<h1>How To Automatically Delete Trash In WordPress<\/h1>\n<p><strong data-start=\"327\" data-end=\"370\">Automatically Delete Trash In WordPress<\/strong> is an effective way to keep your website database clean and optimized. By default, WordPress stores deleted posts, pages, and comments in the Trash folder for 30 days before removing them permanently. While this feature helps recover accidentally deleted content, it can also increase database size over time. Learning how to Automatically Delete Trash In WordPress can help improve website performance, reduce database clutter, and save valuable hosting resources. In this guide, we&#8217;ll show you how to Automatically Delete Trash In WordPress using simple methods that require minimal technical knowledge.<\/p>\n<h2>What Is The WordPress Trash Feature?<\/h2>\n<p>The Trash feature in WordPress acts similarly to the Recycle Bin on a computer. When you delete a post, page, comment, or other supported content, WordPress does not remove it permanently right away. Instead, it moves the item to the Trash folder.<\/p>\n<p>This allows website administrators to recover content if it was deleted accidentally. After the default retention period of 30 days, WordPress permanently deletes the item automatically.<\/p>\n<p>Although this feature is helpful, websites with frequent content updates may accumulate a large amount of trash data that serves no purpose. In such cases, adjusting the trash retention period can help maintain a cleaner and more efficient website.<\/p>\n<h2>How To Automatically Delete Trash In WordPress<\/h2>\n<p>There are multiple ways to automate trash deletion in WordPress. The most common method involves modifying the wp-config.php file.<\/p>\n<h3>Method 1: Change Trash Retention Period Using wp-config.php<\/h3>\n<h3 data-section-id=\"1xfbx8e\" data-start=\"0\" data-end=\"98\">Step 1: Login to cPanel from WebyStrata Client Area<\/h3>\n<p data-start=\"446\" data-end=\"570\">First, visit the WebyStrata website and log in to your client area account using your registered email address and password.<\/p>\n<p data-start=\"446\" data-end=\"570\">official Website <a href=\"https:\/\/www.webystrata.com\">www.webystrata.com<\/a><\/p>\n<p data-start=\"291\" data-end=\"308\"><span style=\"color: #000000;\">After logging in:<\/span><\/p>\n<ol data-start=\"310\" data-end=\"429\">\n<li data-section-id=\"ygoy3r\" data-start=\"310\" data-end=\"331\"><span style=\"color: #000000;\">Go to <strong data-start=\"319\" data-end=\"331\">Services<\/strong><\/span><\/li>\n<li data-section-id=\"wyqca4\" data-start=\"332\" data-end=\"359\"><span style=\"color: #000000;\">Click on <strong data-start=\"344\" data-end=\"359\">My Services<\/strong><\/span><\/li>\n<li data-section-id=\"8kxumo\" data-start=\"360\" data-end=\"397\"><span style=\"color: #000000;\">Select your active hosting service<\/span><\/li>\n<li data-section-id=\"4ekbul\" data-start=\"398\" data-end=\"429\"><span style=\"color: #000000;\">Click on <strong data-start=\"410\" data-end=\"429\">Login to cPanel<\/strong><\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-13370\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1902\" height=\"957\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11.webp 1902w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11-300x151.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11-1024x515.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11-768x386.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11-1536x773.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/login-into-cpanel-11-18x9.webp 18w\" sizes=\"(max-width: 1902px) 100vw, 1902px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Under Tools Select <strong>Files <span style=\"color: #000000;\">\u2192\u00a0<\/span> File Manager.\u00a0<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-13371\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1917\" height=\"906\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4.webp 1917w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4-1024x484.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4-768x363.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4-1536x726.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/files-filemanager-4-18x9.webp 18w\" sizes=\"(max-width: 1917px) 100vw, 1917px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Navigate to:<\/li>\n<\/ul>\n<pre><code class=\"language-text\">public_html<\/code>\r\n\r\n\r\n<img decoding=\"async\" class=\"alignnone size-full wp-image-13372\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"903\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2-300x141.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2-1024x482.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2-768x362.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2-1536x723.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/public-html-2-18x8.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/>\r\n\r\n\r\n<\/pre>\n<p>Locate the file named:<\/p>\n<pre><code class=\"language-text\">wp-config.php<\/code>\r\n\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13373\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"905\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php-1024x483.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php-768x362.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php-1536x725.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/wp-php-18x8.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/>\r\n\r\n<\/pre>\n<h4>Step 2: Edit The wp-config.php File<\/h4>\n<ul>\n<li>Right-click the file and choose <strong>Edit<\/strong>.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13374\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1915\" height=\"903\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3.webp 1915w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3-300x141.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3-1024x483.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3-768x362.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3-1536x724.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit1-3-18x8.webp 18w\" sizes=\"(max-width: 1915px) 100vw, 1915px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Again Click <strong>Edit<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13375\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"907\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4-1024x484.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4-768x363.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4-1536x726.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/edit2-4-18x9.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Find the following line:<\/p>\n<pre><code class=\"language-php\">\/* That's all, stop editing! Happy publishing. *\/\r\n<\/code><\/pre>\n<p>Just above it, add:<\/p>\n<pre><code class=\"language-php\">define('EMPTY_TRASH_DAYS', 7);\r\n<\/code><\/pre>\n<p>This setting tells WordPress to permanently delete trash items after 7 days instead of the default 30 days.<\/p>\n<h4>Common Examples<\/h4>\n<p>Delete trash after 1 day:<\/p>\n<pre><code class=\"language-php\">define('EMPTY_TRASH_DAYS', 1);\r\n<\/code><\/pre>\n<p>Delete trash after 14 days:<\/p>\n<pre><code class=\"language-php\">define('EMPTY_TRASH_DAYS', 14);\r\n<\/code><\/pre>\n<p>Delete trash after 30 days:<\/p>\n<pre><code class=\"language-php\">define('EMPTY_TRASH_DAYS', 30);\r\n<\/code><\/pre>\n<p>Disable Trash completely:<\/p>\n<pre><code class=\"language-php\">define('EMPTY_TRASH_DAYS', 0);<\/code>\r\n\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13376\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"906\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code-1024x484.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code-768x363.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code-1536x726.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/code-18x9.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/>\r\n\r\n<\/pre>\n<ul>\n<li>\u00a0 Save the file after making your changes by Clicking <strong>Save Changes<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13377\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"906\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10-1024x484.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10-768x363.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10-1536x726.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/save-10-18x9.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Method 2: Empty Trash Manually<\/h2>\n<p>If your website doesn&#8217;t generate much deleted content, you may prefer to clear the Trash manually.<\/p>\n<h3>Delete Posts From Trash<\/h3>\n<ol>\n<li>Go to <strong>Posts \u2192 Trash<\/strong>.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13378\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1918\" height=\"910\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash.webp 1918w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash-1024x486.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash-768x364.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash-1536x729.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/trash-18x9.webp 18w\" sizes=\"(max-width: 1918px) 100vw, 1918px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>2. Select the items you want to remove.<\/p>\n<p>3. Click <strong>Delete Permanently.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13379\" src=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4.webp\" alt=\"how-to-automatically-delete-trash-in-wordpress\" width=\"1912\" height=\"905\" srcset=\"https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4.webp 1912w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4-300x142.webp 300w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4-1024x485.webp 1024w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4-768x364.webp 768w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4-1536x727.webp 1536w, https:\/\/www.webystrata.com\/blog\/wp-content\/uploads\/2026\/06\/delete-4-18x9.webp 18w\" sizes=\"(max-width: 1912px) 100vw, 1912px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>While manual deletion works well for smaller websites, automation is generally more efficient for websites with frequent content updates.<\/p>\n<h2>Best Practices Before Enabling Automatic Trash Deletion<\/h2>\n<p>Before changing WordPress trash settings, keep these recommendations in mind:<\/p>\n<ul>\n<li>Create Regular Backups<\/li>\n<li>Choose A Suitable Retention Period<\/li>\n<li>Monitor Website Performance<\/li>\n<li>Test Changes Carefully<\/li>\n<\/ul>\n<h2>Benefits Of Automatically Delete Trash In WordPress<\/h2>\n<p>1. Improves Website Performance<\/p>\n<p>2. Saves Hosting Storage Space<\/p>\n<p>3. Keeps The Database Organized<\/p>\n<p>4. Reduces Manual Maintenance<\/p>\n<p>5. Improves Backup Efficiency<\/p>\n<h2>Conclusion<\/h2>\n<p>Knowing how to Automatically Delete Trash In WordPress is an important part of WordPress maintenance. Whether you use the wp-config.php method or a cleanup plugin, configuring WordPress to Automatically Delete Trash In WordPress helps improve performance, save storage space, and maintain a healthy database. By choosing to Automatically Delete Trash In WordPress, you can reduce unnecessary clutter and ensure your website remains fast, secure, and optimized for long-term growth. If you regularly manage content, implementing a solution to Automatically Delete Trash In WordPress is highly recommended.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How To Automatically Delete Trash In WordPress Automatically Delete Trash In WordPress is an effective way to keep your website database clean and optimized. By default, WordPress stores deleted posts, pages, and comments in the Trash folder for 30 days before removing them permanently. While this feature helps recover accidentally deleted content, it can also [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":13380,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2,10],"tags":[],"class_list":["post-13369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-latest-updates","category-cpanel","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/13369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/comments?post=13369"}],"version-history":[{"count":1,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/13369\/revisions"}],"predecessor-version":[{"id":13422,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/posts\/13369\/revisions\/13422"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/media\/13380"}],"wp:attachment":[{"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/media?parent=13369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/categories?post=13369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webystrata.com\/blog\/wp-json\/wp\/v2\/tags?post=13369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}