19 Dec 2014     Wordpress v4.1

Delete empty post problem

To see the problem, follow the steps below:
  1. Enter the Dashboard
  2. Install bad-plugin and activate it
  3. Select command 'Add new' in 'Posts'-submenu and then press 'Safe Draft'.

After this you will see an empty post you have created on the Posts-page.

Without bad_plugin you cannot create such a post. But now you can.

Perhaps you do not understand where it is from. You remember the last change in your Wordpress was the bad_plugin. And you delete it with no doubt.

And here is the Problem: You cannot delete your empty post

Why cannot?

Open wp-includes/post.php in Editor.

See the marked line where wp_insert_post($post) is called. The matter is that wp_insert_post returns 0 but wp_trash_post knows nothing about it.

What to do?

Admin should be able to delete any post.

Wp_trash_post does not need to call wp_insert_post with all its checking and only has to change post_status desplite post's incorrectness. There should be no requirement to the post intended to be deleted.

The return from trash should be the same because no one is able to correct a trashed post.

PS: Smart minds can offer another plugin as a cure. But I think that is the wrong way.