Make WordPress Core

Opened 3 months ago

Closed 3 months ago

#64453 closed defect (bug) (reported-upstream)

Label of button 'Move to trash' on Settings Panel in Block Editor not changed when constant EMPTY_TRASH_DAYS is defined as false

Reported by: ignatiusjeroe's profile ignatiusjeroe Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.9
Component: Editor Keywords:
Focuses: ui, javascript Cc:

Description

The Move to Trash button in the Settings Panel in the Block Editor doesnt display the proper text when the constant 'EMPTY_TRASH_DAYS' is defined as false. This constant, when set to false disables the trash function. In the classic editor the button's label is changed from 'Move to trash' to 'Delete permanently'. This doesnt happen in the Block Editor. The button's label remains 'Move to trash' irrespective of the value of 'EMPTY_TRASH_DAYS'. The button actually does do its job, but the browser confirmation message must be altered, as well as the admin notification when redirected to the All Posts page after the button has been pressed.

Bug instructions:

  • Add following snippet in wp-config.php: define('EMPTY_TRASH_DAYS', false );
  • Open post in Block Editor
  • Goto Settings Panel > Post. Find the red button labelled 'Move to trash'. It should have been renamed to 'Delete Permanently'.
  • Clicking on it triggers a confirmation window. The message is 'Are you sure you want to move "[post title]" to the trash?'. It should be 'Are you sure you want to permanently delete "[post title]"?'. The button should also be renamed to 'delete permanently'.

Attachments (1)

Screenshot 2025-12-25 at 23.22.10.png (82.5 KB) - added by ignatiusjeroe 3 months ago.

Download all attachments as: .zip

Change History (4)

#1 @hbhalodia
3 months ago

Hi @ignatiusjeroe, Thanks for the issue.

Firstly, EMPTY_TRASH_DAYS as per https://codex.wordpress.org/Trash_status#:~:text=(int)%20%3E%3D%200%C2%A0%3A%20the%20length%20of%20days%20before%20items%20are%20permanently%20deleted.%20Default%C2%A0%3A%2030, the EMPTY_TRASH_DAYS should be int (>=0) instead of boolean. Though,

I can verify this indeed an issue, as if we add 0 to the constant, which means that no place for trashing, directly delete, the action is performed correctly in post editor, but the notifications, labels and even admin notice says the item is moved to trash. We need to change it to proper labels.

IMO, this should be raised in upstream GB repository, I will create the issue there and will add the link.

#3 @wildworks
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.