可以利用pre_delete_post
过滤以缩短帖子的删除。
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 the post author
if( get_current_user_id() === $post->post_author ) {
return $delete;
}
//* Returning any other value besides null will short circuit the deletion
return true;
}