Articles of trash

Comment Spammed vs Trashed

What’s the difference between marking a comment as spam and trashing it?

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 before the trash function does not give me the option to cancel the trash procedure. To […]

When trashing a post, also trash related comments

As it is now, when I trash a post, the related comments get deleted at once. Is this standard? Instead I’d like them to be moved to the trash bin, when I trash the post. How can I achieve this? I can’t seem to find a solution.

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?

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 string “postIds” in the URL gets replaced by comma-separated post IDs via javascript. All this does thus far is redirect me to the edit screen in the backend. How do I need to generate this […]

wp_trash_post not firing

I want to call a function when a post is placed into the trash. I want to do something more complicated than the following, but have simplified to what’s below just to see if it’ll work and it doesn’t. function gna_my_function() { echo ‘trashed ‘; } add_action(‘wp_trash_post’, ‘gna_my_function’); Thanks

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 them deleted automatically? What happen, please advice me?

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 manage_pages_columns to add columns, but these hooks add columns to more than just the trash view. I can see from the […]

Add frontend “Restore” link

I am using get_delete_posts_link($postid) to let users send their posts to the trash from the frontend. Now I’m trying to replicate the same functionality for them to “untrash” or restore the posts as well. get_delete_posts_link($postid) seems to generate a URL like this: http://mysite.com/wordpress/wp-admin/post.php?post=555&action=trash&_wpnonce=0d6fc30f3b And when I go to wp-admin and look at what link the […]

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 or events. If the company profile gets deleted, all other posts from this user are also deleted. […]