How to prevent users from permanently deleting a post from trash, but allow them to restore it?
How to prevent users from permanently deleting a post from trash, but allow them to restore it?
How to prevent users from permanently deleting a post from trash, but allow them to restore it?
Technically, defining define(‘EMPTY_TRASH_DAYS’, 0 ); in wp-config.php file should delete whatever is in Trash after zero days. I just tried it, but didn’t work immediately. I may have to wait for a day to see the result.
Set “move to trash” as the default bulk action
is possible to interupt a post deletion when empty the trash
You can use add_filter() for post_row_actions to filter out the ones you don’t want, add in the functions you do want. Like so: <?php /** Plugin Name: (wpse) Draft vs. Trash Posts */ add_filter( ‘post_row_actions’, ‘my_plugin_update_actions’, 10, 2 ); function my_plugin_update_actions($actions, $post) { $capability = ‘promote_users’; $role=”Administrator”; // Choose what you want to check against. … Read more
Unless you have a backup of your database then most probably your page is unfortunately gone forever. You could try contacting your hosting provider and ask if they have a backup stored somewhere.
If you don’t have any posts in the Trash, then there won’t be a link to go and see them. What would be the point of displaying a link to an empty page, after all? The link to Trashed posts appears on the All Posts screen at the top, right alongside All | Published | … Read more
Sort trash by date post was trashed
Hook onto trashed_post and use wp_untrash_post() to reverse upon meeting a condition, pseudocode example… add_action(‘trashed_post’, ‘wpse_218031_trashed_post’); function wpse_218031_trashed_post($post_id){ //use post_id to check conditions… if not met call: if ( $some_condition ) { wp_untrash_post($post_id); } } trashed_post runs after wp_trash_post and after the post is moved to trash. By the way, if the constant EMPTY_TRASH_DAYS is … Read more
There are two hooks you should be considering– wp_trash_post and trashed_post. Based on your statement that you want this to work “when a post is placed into the trash” I’d suggest the latter is the better hook, since it runs after the post is successfully placed in the trash. I hate to suggest this as … Read more