[wp-trac] [WordPress Trac] #17115: Publishing an empty post results in success

WordPress Trac noreply at wordpress.org
Mon Dec 16 21:52:47 UTC 2013


#17115: Publishing an empty post results in success
----------------------------+------------------------------
 Reporter:  kawauso         |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.1
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------

Comment (by nerrad):

 Replying to [comment:13 ericmann]:
 > Ported a patch for this ticket, based on the existing work on #11082.
 Basically, check to see if the status of the "saved" post is still auto-
 draft.  If so, it means things didn't save to the database and we should
 notify the author of that fact.
 >
 > Just to clarify, there is a safeguard in core against adding posts with
 empty content.  If the title, content, and excerpt are all empty, and the
 theme supports title, content, and excerpt for the post type, then
 `wp_insert_post()` will bail out early and nothing will be saved - this
 also means the `save_post` hook will not run.  This functionality can be
 disabled with a hook:
 >
 > {{{
 > add_filter( 'wp_insert_post_empty_content', '__return_false' );
 > }}}
 >
 > See ~line 2670 of /wp-includes/post.php for details on the hook and what
 it's testing against.

 I saw that code but it appears that if title, content, and excerpt are all
 empty this bailout guard is NOT happening.  Instead posts ARE getting
 saved to the db.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/17115#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list