Questions tagged [trash]
The trash tag has no usage guidance.
81
questions
0
votes
0
answers
8
views
Prevent users to delete comments from trash
As told in the title, I am looking for a way to prevent users to delete comments from the trash. Only admins should be able to.
I tested the scripts at:
Function to prevent users from trashing ...
0
votes
0
answers
9
views
How to display "Trash" in my custom post type?
what does it take to display the Recycle Bin in my own Custom Post Type?
function my_custom_post_specialist() {
$labels = array(
'name' => _x( 'Terapeuci', 'post type ...
0
votes
0
answers
19
views
is possible to interupt a post deletion when empty the trash
it is possible once called a before_delete_post action not to allow WP to delete post on certain condition?
something like e this:
add_action( 'before_delete_post', 'my_custom_delete', 10);
function ...
0
votes
0
answers
29
views
Set "move to trash" as the default bulk action
I need only "move to trash" bulk action and I want to set it as the default bulk action. Then, I will hide the select field with css. To delete a post, I will just put a tick in a checkbox ...
0
votes
1
answer
55
views
Get rid of "trash can" for custom post type
I have a CPT "foo".
I want to totally disable the "trash can" feature, so that any time on the the CPTs is deleted, it is simply permanently removed. Not put in the trash can. How ...
0
votes
1
answer
42
views
How can I specify the post status of an untrashed post?
By default Wordpress assigns the draft status to a post that has been untrashed. I would like to assign the pending status to posts that are untrashed.
This seems to be possible with ...
0
votes
1
answer
407
views
Cancelled orders move to Trash automatically in Woocommerce - how to disable?
I have a Wordpress 5.4.1. website, with Woocommerce 4.1.1. installed.
It seems that orders which have the status "Cancelled" move to Trash automatically after one month passes (from the order date). ...
1
vote
0
answers
216
views
How can Reusable Blocks be fully deleted?
All of the reusable blocks on one of my sites were deleted last week. Not just deleted, but the trash emptied. I've already had a security vendor audit the site, and they concluded there was no hack, ...
1
vote
1
answer
1k
views
Shortcode to delete post from front end
I'm trying to create a short code to delete post that user publish from the front end of my site.
I've tried the short-code below but I keep getting the error "The link you followed has expired." ...
2
votes
1
answer
246
views
Can I differentiate between "Delete Post Permanently" and "Empty Trash" and do something for each accordingly?
I'm currently working on developing a plugin with a custom post type of "Dealer Location". (Not relevant to question, just a bit of background)
When a post is in the trash and "delete permanently" is ...
0
votes
1
answer
1k
views
Remove Featured Image & All Media Uploaded to the Post
I found a solution of removing featured image related to the post when delete the post from this article but, I want to remove all the uploaded media also with post removing. Delete all WP image ...
0
votes
1
answer
38
views
Restore page after deleting it from trash
I accidentally deleted a page in my trash area, is there a way I can restore it? I can no longer find the page.
0
votes
0
answers
171
views
Bulk trashing post 'fails'
I want to bulk delete child posts of a custom post type, and I've made it work. I'm in class context:
// In a register method which registers all hooks.
add_action( 'wp_trash_post', [ $this, '...
1
vote
0
answers
204
views
posts comments goes to trash
My website was working fine until today, I just discovered that all comments made goes straight to trash.
I did not install new plugins, I don't have akismet. It just started. I have deactivated all ...
4
votes
2
answers
2k
views
wp_delete_post() deletes post instead of moving it to trash
I have set up a custom post type, which user can edit from the frontend. I'm using wp_delete_post() to allow users to delete a post they created. It works, but the posts get deleted instead of being ...
4
votes
1
answer
266
views
Does WP fire delete_post when trashed posts are automatically deleted?
I have a custom db table that stores additional post data and I need to delete posts from my custom table when the original post is deleted.
Will WP fire the delete_post action below and run ...
2
votes
1
answer
680
views
get_post() function returns post even if it is trashed
I'm developing a WordPress theme. I am selecting one post as a 'featured post' from the customizer settings. I want to display this post differently on home page. I'm using following code to get the ...
4
votes
1
answer
5k
views
Remove Trash / Delete option for Custom Post Type / Taxonomy
I've created a custom post type prj, and I need to disable move to trash option by any user role! Same goes with a taxonomy org associated with the same post type.
Here is the code I've come up with ...
0
votes
1
answer
112
views
Script doesn't trash custom post types. Instead it duplicates the post and generate new versions in the trash
I've a function which deletes custom post types after a specific time. In my case after 30 days. The problem is, that the posts are not trashed. Instead WordPress creates a new version of the post ...
0
votes
0
answers
44
views
WordPress deletes custom posts instead of trash them
I need to trash some custom posts, under certain conditions, via code (it's a plugin self-written)
The theme used is a children
I don't shutdown the ability to trash the post;
In config.php there ...
2
votes
1
answer
676
views
Error after deleting Custom Post Type with a function (no trash used)
I'm using a function which I built to delete all posts from a user after a specific post is deleted. In my case I'm using a Custom Post Type called company. And additional Custom Post Types like jobs ...
0
votes
1
answer
185
views
How can i take all ids from untrash_post action?
When the user chooses to restore a post ( from "Trash" folder ) with the following way, through the action untrash_post, i get the id of the posts.
function my_untrash_post_type( $post_id )
{
...
0
votes
2
answers
7k
views
How to recover permanently deleted blog posts?
I accidentally deleted about 20 blog posts and they were in my trash folder for over a month and now have permanently deleted. I was wondering if there's a way to recover these? For example I have ...
0
votes
2
answers
309
views
SQL Command for restoring trashed comments
When trashing a post, also trash related comments
so here is what i want, what‘s’ the sql Command
I want to move some post to trash according their ID, what is the sql command,I can restore these ...
0
votes
1
answer
452
views
wp_trash_post hook - problem with page updating if using wp_die
I am building a plugin which in some cases prevents certain posts from being put into the bin. For this, I am using "wp_trash_post". In the callback function, I do the logic to check if the post can ...
2
votes
1
answer
2k
views
Can a user with admin role get 'Sorry, you are not allowed to move this item to the Trash' error when trashing a post?
I got the wp_die error message:
Sorry, you are not allowed to move this item to the Trash.
on trying to put the post in trash, but when I tried to put it in trash again the wp_die error message:
...
2
votes
1
answer
301
views
Why trash folder got empty automatically?
Yesterday I move some of my WordPress product to trash, and keep only 4 products available.
Today I open my site, all trash products was not there? But the 4 products still there.
I don't know are ...
1
vote
1
answer
10k
views
How to restore permanently trash page? [closed]
I have accidentally permanently deleted the home page from my website.
Is there any way how to restore it? :(
Thank you in advance.
0
votes
1
answer
71
views
Trash in WP 3.8?
For some reason the trash link (to see the trashed posts) is missing, but I'm not sure if it's even supposed to be there in version 3.8.1
We do have the choice to trash an item
But I can't see where ...
1
vote
1
answer
665
views
How to untrash a post only if it was not a draft?
I know I can do
wp_untrash_post( $post_id );
And check the post status with
$post_status = get_post_status ( $post_id )
I'm in a situation where I must untrash some posts but only if the post ...
2
votes
2
answers
1k
views
Exclude trash from save_post
I have a function which processes custom metabox data on saving my custom post type:
add_action('save_post_customtypehere','myown_save_customtype_fn');
function myown_save_customtype_fn($ID) { ... }
...
2
votes
1
answer
307
views
Restore trashed posts with comments
When a WordPress post is trashed, all the comments are trashed as well. I would expect the "undo" button to restore both the post and the comments. However, all the comments seem to just disappear : ...
2
votes
1
answer
140
views
How to add a column to the Trash page?
I'm trying to add a column to the trash page for posts and pages but can't find a way to hook into that specific area. I've been able to use functions like manage_posts_columns and ...
1
vote
2
answers
2k
views
custom post type, hide or disable the trash button in publish meta box
I have been adding a post type to my theme, how do I hide/disable the Move to trash button?
Here is my code so far:
$labels = array(
'name' => _x( 'Inhoud', 'taxonomy ...
3
votes
2
answers
2k
views
Trash bin for categories
Today I accidently happend to delete my category right after I've noticed there is no trash in categories. I wonder is there any way to include trash bin for it? I've made a little research over a ...
1
vote
1
answer
751
views
How to cancel the trash action inside wp_trash_post
I need to restrict the button "EMPTY TRASH" and make it delete only the posts only if the logged in user is the creator.
I tried to use the wp_trash_post and i need to decide in the function if i ...
0
votes
2
answers
704
views
How to cancel an action hooked to untrash_post? or any hook
I want to do the following in a plugin:
- hook to untrash_postwith a custom function
- do some checking inside custom function
- cancel actual post restoring (untrashing)
I've tried with ...
0
votes
1
answer
2k
views
Wordpress has a trash for users? (Wrong result for count_user, greater than expected)
I am using count_users() function to count users on my wordpress sites. In my administration area -> 'Users' I can see 7 users, but the function returns 9. After some time, searching for errors in my ...
1
vote
1
answer
724
views
Control whether or not to trash a custom post type
I need to have control over the trash / delete action on a custom post type.
I need to check for some conditions and decide if i should trash the CPT or not.
The wp_trash_action hook that is fired ...
2
votes
1
answer
3k
views
How can I hook into existing WordPress Bulk actions?
I am creating a plugin which syncs both standard WP data and custom fields within a custom meta box on post edit pages, to an external resource using SQL queries. However my functions are currently ...
0
votes
1
answer
1k
views
How to change 'Move to Trash' to 'Move to Draft' for my blog's users?
I want that only Admin and Editor roles can use the 'Move to Trash' option in my blog, and other users will get the 'Move to Draft' option instead.
Like inside of the 'Quick Edit' / 'Bulk Actions' ...
0
votes
1
answer
572
views
Nonce for Trashing Item
I have a custom admin page.
On it, I have created a filtered list of the custom post type based on postmeta data.
I have to create a link to delete that post.
I am trying to figure out how to ...
1
vote
1
answer
429
views
How can I trash multiple posts at once from the front end?
I took a peek at the code in edit.php and am now generating links with this code:
wp_nonce_url("/wp-admin/edit.php?doaction=trash&post_type=post&ids=postIds", "bulk-posts")
The ...
0
votes
1
answer
61
views
Post deleted in trash [closed]
I need a plugin or some method to recover deleted post of trash.
2
votes
3
answers
2k
views
Undelete post (untrash)?
Which function should be used to move post from trash to published pages?
i.e. is there wp_undelete_post or something like?
1
vote
0
answers
84
views
Sort trash by date post was trashed
Is it possible to sort the trash for post by the last post added to trash.
EG: I trash post 4,2,1,3,5
I would like these post to be sorted in trash by the last post trashed, so they would appear in ...
1
vote
1
answer
1k
views
Missing 'Move to Trash' option from bulk select box
I seem to be missing the bulk select option for moving multiple items to the trash. This happens when all plugins are deactivated as well. Has anyone come across this before?
http://i.stack.imgur.com/...
0
votes
2
answers
2k
views
Changing a post status name
How do I change the status name "Trash" to "Archive". I don't want to change the functionality of the status or make a new status. I have tried Edit Flow custom status but I get some conflicts with ...
0
votes
1
answer
1k
views
How to retrieve the date on which a post was moved to trash?
I need to retrieve a list of posts that are in trash based on the date on which they were trashed.
The following code allows me to retrieve posts that are in trash, but how to filter them by date?
...
0
votes
1
answer
365
views
wp.getPosts with status = 'trash' using node.js
I was wondering how to set the filter option for wp.getPosts. I want to get posts with a status of 'trash'. filter is currently blank, and returns all posts other than trash.
I am using the xmlrpc ...