[wp-trac] [WordPress Trac] #55152: Cannot delete post content if the title is empty

WordPress Trac noreply at wordpress.org
Mon Feb 14 04:07:37 UTC 2022


#55152: Cannot delete post content if the title is empty
-------------------------------+------------------------------
 Reporter:  wpdans             |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  2.1
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------
Changes (by peterwilsoncc):

 * version:  5.9 => 2.1


Comment:

 Hi @wpdans and welcome to trac!

 This is due to a block of code in `wp_insert_post()` that
 [https://github.com/WordPress/wordpress-
 develop/blob/b83a8be65054cd890e24c7c1416ebbb39aeb4c09/src/wp-
 includes/post.php#L4117-L4145 prevents the saving of empty posts].
 `wp_insert_post()` is used for updating posts too.

 A post is considered empty if the post's title, content and excerpt are
 empty. The filter `wp_insert_post_empty_content` is available to allow
 developers to modify what causes a post to be considered empty.

 This only applies to post types supporting the title, content (editor
 support) and excerpt (such as the built in `post` and `pages` post types).

 Some history of this check can be seen in #18713, #2390 and #3097. I've
 updated the version listed on this ticket to 2.1 to indicate when the
 check was introduced.

 I don't think the behavior you are seeing is a bug but I'll keep the
 ticket open for now as it may be possible to fine tune how the check
 works.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55152#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list