Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#61598 new enhancement

Add an interface option to let users set empty_trash_days

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

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.


4 weeks 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:


4 weeks ago
#2

@Debarghya-Banerjee left smaill suggestion. Overall LGTM.

@debarghyabanerjee commented on PR #6996:


4 weeks 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.