Sorry if there is already an answer to this but I couldn't find it.
So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message:
But I want this message gone because even if u the press undo button it just says:
the code for deleting the posts is:
function members_skip_trash($post_id) {
if (get_post_type($post_id) == 'members') {
// Force delete
wp_delete_post( $post_id, true );
}
}
add_action('trashed_post', 'members_skip_trash');
So how do I get rid of the 1 post moved to the trash message?
A quick and dirty way to do it would be to find this file:
/wp-admin/edit.php
And comment out the following line:
echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
Of course that will get rid of all your 'moved to Trash' messages. So you'll probably want to keep it in there, but check for your custom post type first.
Or better yet, figure out how to override this from your functions.php
file so the next WP update doesn't kill it.