Open manake opened 5 years ago
Which option do you have in your wp-config?
define( 'EMPTY_TRASH_DAYS', 0 );
Thanks, we will work on it.
The docs:
If this constant is set to 0, the trash functionality will be disabled and the 'Delete Permanently' button will appear instead of 'Trash' button. If you click 'Delete Permanently' button, the item will immediately be deleted without any alert message.
https://codex.wordpress.org/Trash_status#EMPTY_TRASH_DAYS_option
@manake @Soean @swissspidy I have tried to reproduce the bug but I failed. Could you please provide more details about this bug?
@Jackie6 I was able to reproduce.
You have to edit the post with Gutenberg, and click the Move to trash button on the right-hand sidebar. (see below screenshot)
I wanted to fix it, but I'm unsure how to check if the value of EMPTY_TRASH_DAYS
is 0
in the PostTrash component.
@gbroques Thanks for comments. I have no idea about getting the value of EMPTY_TRASH_DAYS
. I found two links that may be helpful
how to pass variables and data from PHP to JavaScript?
get_defined_constatns
If I'm understanding the recommended and established patterns in this codebase correctly, then we would want to expose the value of EMPTY_TRASH_DAYS
in the WordPress REST API.
I looked, and EMPTY_TRASH_DAYS
doesn't appear to be available through the WordPress REST API.
Anyone else have thoughts on whether exposing and retrieving EMPTY_TRASH_DAYS
from the WordPress REST API is the right approach (perhaps through settings)? Or maybe there's some existing store
containing this value that we don't know about.
I don't think the actual constant value should be exposed. Instead, the schema args for force
should be set to required
when it is required by the current configuration.
Adding a link with a rel
of something like api.w.org/delete
with a hrefSchema
could also be added to account for the rest_post_trashable
filter which is post specific.
Something like:
$links→add( 'https://api.w.org/trash', "$self/{?force}", [
'hrefSchema' => [
'force' => [
'type' => 'boolean',
'required' => true,
]
] );
I have the same error appearing for posts created before Gutenberg.
The post does not support trashing. Set 'force=true' to delete.
I need to go in the Posts list screen and delete it from there.
Having the same issue in October.
This happens with all my sites. There's nothing special about them. If it helps, here's what I have in wp-config.php
:
define('WP_POST_REVISIONS', false);
define('MEDIA_TRASH', false);
define('EMPTY_TRASH_DAYS', '0');
Hi @manake and others Is this issue still valid and if so how can we move it forward?
I'm seeing this issue on WP 5.8.2 & WP 5.9-beta2-5236
Video from 5.9. I haven't tested the latest Gutenberg but reading the code I don't think it would have any different behavior
https://user-images.githubusercontent.com/1290739/146067593-9a42974f-b8e9-4bb0-a3dc-7a641164a72c.mp4
I was never able to delete a post or a page from the block editor since Gutenberg came out (years ago). I always have to go to Posts (or Pages), select the post and delete from the dropdown. On all my sites and my clients' sites, hundreds of them.
It's something I live with.
The issue is still valid in WP 6.3.
The post does not support trashing. Set 'force=true' to delete.
My wp-config.php has force delete but the button still says "Move to Trash" in Gutenberg (should say "Delete Permanently").