المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ووردبريس Wordpress تعطيل التفريغ بعد 30 يوم wordpress trash auto delete



Rise Company
25-05-2020, 01:48
ووردبريس Wordpress تعطيل التفريغ بعد 30 يوم wordpress trash auto delete
How To Optimize WordPress Trash Settings
wordpress how to save trash permently
wordpress trash auto delete

https://www.rise.company/upload/uploads/159036471944831.png

What is Trash in WordPress?

When you delete a post, page, or a comment in WordPress, it is marked as trash (https://www.wpbeginner.com/glossary/trash/).

https://www.rise.company/forum/images/imported/2020/05/47.jpg

You can see the trashed posts or comments by clicking on the Trash link when viewing posts, pages, or comments.
By default, these items will remain there for 30 days. After that, WordPress will automatically delete them permanently.
You can override the automatic process by going to trash and deleting the items manually by clicking on the delete permanently link.

https://www.rise.company/forum/images/imported/2020/05/31.png


But what if you don’t want WordPress to delete items from trash? Or maybe you want WordPress to automatically delete items sooner or later than 30 days.
Let’s take a look at how to limit or disable automatic WordPress empty trash feature.

Stopping WordPress from Automatically Emptying Trash

Do you want to stop WordPress from automatically deleting items from trash? Here is what you need to do.
Simply add this little code snippet in your theme’s functions.php (https://www.wpbeginner.com/glossary/functions-php/) file or a site-specific plugin (https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/).


function wpb_remove_schedule_delete() {
remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
}
add_action( 'init', 'wpb_remove_schedule_delete' );


This code simply removes the action that deletes trashed items when their time is up.
Now when you send an item to trash, it will remain there until you go to trash and manually empty the trash.

Changing When to Empty Trash in WordPress

As we mentioned earlier, WordPress automatically empty trash after 30 days. You can change this to any number of days you want.
Simply add the following line of code in your wp-config.php (https://www.wpbeginner.com/beginners-guide/how-to-edit-wp-config-php-file-in-wordpress/) file just before the line that says ‘That’s all, stop editing! Happy blogging.’


define('EMPTY_TRASH_DAYS', 7);


This line changes the trash emptying schedule to 7 days. You can change 7 to any number of days that you want.

-----------------------------------------------------
بلوجن plugin جاهز لتعديل وقت تفريغ Trash
-----------------------------------------------------

https://www.rise.company/upload/uploads/159036476169661.png

https://wordpress.org/plugins/change-wp-empty-trash-time/