How to cancel the trash action inside wp_trash_post

It’s possible to utilize the pre_delete_post filter to short-circuit the deleting of posts. add_filter( ‘pre_delete_post’, ‘wpse_224246_pre_delete_post’, 10, 3 ); function wpse_224246_pre_delete_post( $delete, $post, $force_delete ) { //* Escape early if post isn’t already trashed if( ‘trash’ !== $post->post_status ) { return $delete; } //* Go ahead with deleting the post if the current user is … Read more

Shortcode to delete post from front end

Following is the reformatted version of your code. get_delete_post_link() is used for fetching delete post URL so that we dont have to worry about nonce stuff. global $post is kept to avoid PHP notice which is currently there in your code. Please check it. function wpso_delete_my_posts() { global $post; ob_start(); if ( current_user_can(‘delete_posts’, $post->ID ) … Read more

Comment Spammed vs Trashed

In vanilla WordPress the only difference is that trashed comments get deleted automatically after (customizable) time span. Adding plugins to the picture – it might make difference to what/how specific plugin learns from incoming spam.

When trashing a post, also trash related comments

Well, this is partly true and partly false. When you trash a post, everything that is tied to it is also trashed. This means, if you untrash the post, the comments etc. are untrashed as well. However, comments and other stuff is not handled as if they were trashed directly (i.e., on the Comments page … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)