[wp-trac] [WordPress Trac] #30775: Delete empty post problem
WordPress Trac
noreply at wordpress.org
Wed Dec 24 07:14:12 UTC 2014
#30775: Delete empty post problem
----------------------------+------------------------------
Reporter: axdr | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 4.1
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+------------------------------
Comment (by nacin):
Hi axdr, in the future, please use your bug report to document your bug.
Over the years, single-use web pages like this have gone missing — I have
seen it dozens of times.
----
19 Dec 2014 Wordpress v4.1
Delete empty post problem
To see the problem, follow the steps below:
Enter the Dashboard
Install bad-plugin and activate it
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.
----
Bad plugin:
{{{
add_filter('wp_insert_post_empty_content', 'the_bug', 10, 2);
function the_bug($maybe_empty, $postarr) {
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30775#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list