Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [trash]

The tag has no usage guidance.

0
votes
1answer
20 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
0answers
26 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
0answers
49 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 ...
2
votes
1answer
126 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
1answer
205 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 ...
0
votes
0answers
259 views

wp_delete_post() deletes all custom post type entries without leaving it into trash

I have a custom post type create, and added a couple of posts for this CPT, and I have been trying to add the function of edit/delete post individually. I used wp_delete_post() which accepts $postid ...
1
vote
1answer
51 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 ...
1
vote
1answer
871 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
1answer
27 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
0answers
29 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 ...
0
votes
0answers
40 views

Empty trash hook for wp comment

I need a hook when "empty trash" / "permanently delete" multiple commemts. I will need all comment_ID on this hook. How can I do it? I need a hook something like this add_action('...
2
votes
1answer
218 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
1answer
89 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
2answers
2k 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
2answers
121 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
1answer
87 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 ...
3
votes
1answer
759 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
1answer
83 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 ...
0
votes
1answer
3k 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
1answer
64 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
1answer
149 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 ...
1
vote
1answer
542 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) { ... } ...
3
votes
1answer
201 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
1answer
53 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
2answers
762 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
2answers
622 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
1answer
263 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
0answers
53 views

How to allow a contributor user role can only trash the comment in wordpress?

I want to allow the 'Trash Comment' permission for Contributor role user on his/her uploaded post.
0
votes
2answers
357 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
1answer
845 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
1answer
518 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 ...
1
vote
1answer
1k 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
1answer
614 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
1answer
194 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
1answer
354 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
1answer
58 views

Post deleted in trash [closed]

I need a plugin or some method to recover deleted post of trash.
1
vote
3answers
1k 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
0answers
59 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 ...
0
votes
1answer
839 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
2answers
895 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
1answer
638 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
1answer
229 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 ...
0
votes
1answer
892 views

Restrict access to trash, only admin

I'm new in WordPress. I have to restrict access to the Trash for all users except the administrator. All users CAN move to the Trash, but only admin can delete permanently or restored. I do not know ...
1
vote
1answer
996 views

Custom Role can't trash Custom Post Type

I have a post type that I set up some capabilities for and I attached them to a new Role, however, the role can not trash them. I'm not sure why though. Here is the portion of my array for the ...
0
votes
0answers
62 views

Run Jquery Script after delete post in front end

I have a list of posts on a page on the front end. With each post I have created a delete button with get_delete_post_link. This works fine but I now need to execute some jQuery after the post is ...
0
votes
3answers
402 views

Deleted pages showing up when querying for child pages

I'm using the following code to display the featured image, post_title and custom field data from relevant child pages. <? $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ...
0
votes
0answers
136 views

wp_trash_post retrashes already trashed comments?

I have a few mail- and update_user_meta functions that fires when a post, comment or child comment gets thrashed. So when I trash a comment with trash_comment, a mail get sent to the author: "Hey, ...
0
votes
1answer
201 views

transition_comment_status gets called when untrashing comments

I can't seem to figure out why untrashing a comment, calls my "approve_comment_callback"-action. Any ideas? I just don't want it to send two emails at the same time, when I untrash a comment. Here ...
1
vote
1answer
1k views

Dynamically create/remove terms in taxonomy when custom post type is published/trashed

Am struggling a bit with creating & removing terms based on when a custom post type is published and trashed. Ideally, I would like to create a new term in my custom taxonomy when a custom post ...
0
votes
1answer
100 views

Trash a post, send associated comments into the trash bin (change status)

When trashing a post, all comments associated with this post get the status "post-trashed". They do not end up in the trash bin. In my theme the author gets a point for posting a post or a comment. ...