[wp-trac] [WordPress Trac] #37441: get_default_post_to_edit() function is broken

WordPress Trac noreply at wordpress.org
Mon Sep 1 12:04:17 UTC 2025


#37441: get_default_post_to_edit() function is broken
-------------------------------------------------+-------------------------
 Reporter:  tfrommen                             |       Owner:  rishabhwp
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Posts, Post Types                    |     Version:  5.6
 Severity:  normal                               |  Resolution:
 Keywords:  has-test-info good-first-bug has-    |     Focuses:
  patch has-unit-tests                           |  administration
-------------------------------------------------+-------------------------

Comment (by rishabhwp):

 Replying to [comment:14 SirLouen]:
 > if the execution continues [https://github.com/SirLouen/wordpress-
 develop/blob/da59c19dcaae731f64c9f512d35157e356e25931/src/wp-
 admin/includes/post.php#L774-L775 after this line or not], without that
 code block.

 Yes, the execution proceeds and returns a `WP_Post` object with an ID of
 `0`:

 {{{
 WP_Post Object
 (
     [ID] => 0
     [post_author] => 0
     [post_date] => 0000-00-00 00:00:00
     [post_date_gmt] => 0000-00-00 00:00:00
     [post_content] =>
     [post_title] =>
     [post_excerpt] =>
     [post_status] => publish
     [comment_status] => open
     [ping_status] => open
     [post_password] =>
     [post_name] =>
     [to_ping] =>
     [pinged] =>
     [post_modified] => 0000-00-00 00:00:00
     [post_modified_gmt] => 0000-00-00 00:00:00
     [post_content_filtered] =>
     [post_parent] => 0
     [guid] =>
     [menu_order] => 0
     [post_type] => post
     [post_mime_type] =>
     [comment_count] => 0
     [filter] => raw
     [errors] => Array
         (
             [empty_content] => Array
                 (
                     [0] => Content, title, and excerpt are empty.
                 )

         )

     [error_data] => Array
         (
         )

 )
 }}}

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


More information about the wp-trac mailing list