Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#61598 new enhancement

Add an interface option to let users set empty_trash_days

Reported by: mrfoxtalbot Owned by:
Priority: normal Milestone: Awaiting Review
Component: Posts, Post Types Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Most users are unaware of the empty_trash_days settings or how to change it. This can sometimes make them lose their content if they trash their posts instead of setting them as drafts.

In #61511 I suggested we could display the value of empty_trash_days to minimize confusion but we could go further and introduce a setting to allow users to set this value via their dashboard.

Change History (3)

This ticket was mentioned in ​PR #6996 on ​WordPress/wordpress-develop by ​@debarghyabanerjee.


2 years ago
#1

  • Keywords has-patch added

Trac Ticket - Core-61598

## Summary

Fixes an issue with the EMPTY_TRASH_DAYS value, right now user can't manually set the EMPTY_TRASH_DAYS value
from the backend, so this PR addresses the issue and adds a settings field under Writing, which lets the user set the EMPTY_TRASH_DAYS value.

## Description

### Problem

Right now, the user can't manually set the EMPTY_TRASH_DAYS value from the backend, neither all of them are aware of the process on how to do it. They either need to hire a developer to do the changes or need to manually change it.

### Solution

To resolve this issue, I have made the following changes:

  • Created a Settings field under Writing
  • The default value will always be 30, if the user enters any value, the EMPTY_TRASH_DAYS value would get updated as well.
  • This solution provides a simple UI for the End Users who are not technically sound enough to increase or decrease the EMPTY_TRASH_DAYS value from the backend.

### Changes Made

  • Sanitize the keys of the $_REQUESTautofocus array using sanitize_key().
  • Sanitize the values of the $_REQUESTautofocus array using sanitize_text_field().
  • Combine the sanitized keys and values into a new array using array_combine().

​@khokansardar commented on ​PR #6996:


2 years ago
#2

@Debarghya-Banerjee left smaill suggestion. Overall LGTM.

​@debarghyabanerjee commented on ​PR #6996:


2 years ago
#3

@Debarghya-Banerjee left small suggestion. Overall LGTM.

Hi @itzmekhokan, I have fixed the above requested changes, and have assigned you for re-review again. Thanks :-)

Note: See TracTickets for help on using tickets.