Articles of trash

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 ) { echo ‘<script> alert(‘.$post_id.’); </script>’; wp_die(‘stop’); } add_action(‘untrash_post’ , ‘my_untrash_post_type’); But if the user chooses more than one, posts to restore them, i […]

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(‘comment_empty_multiple’,’myFunction’); function myFunction($array_comment_ids){ // My code }

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 is not set the constant EMPTY_TRASH_DAYS but in default-constant.php I can read /** * Defines functionality related WordPress constants * * […]

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 with new ID and moves this new version in the trash. The status of the old version is still […]

Conditional tag-like function to tell if post is in trash?

What could I put in my theme to tell if a post is in the trash or not? For example: <?php if (is_trash) echo ‘This post is in the trash!’ ?>

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 type is published. Then, when that post in the custom post type is trashed, I need to check […]

What's the difference with trash_comment and wp_trash_comment?

I don’t understand when I’m suppose to use trash_comment over wp_trash_comment. What’s the difference?

Post deleted in trash

I need a plugin or some method to recover deleted post of trash.

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 create the link with a nonce. sprintf(‘<a href=”post.php?post=%s&action=%s&_wpnonce=%s” class=”link-course-delete”>Trash</a>’,$item[‘ID’],’trash’,wp_create_nonce(???)) I am not sure what […]

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 remove_action but doesn’t seem to work. Can you point me into the right direction? Code sample: add_action( ‘untrash_post’, array( __CLASS__, ‘static_untrash_handler’ ) ); […]