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

WordPress Trac noreply at wordpress.org
Mon Sep 1 11:38:57 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 siliconforks):

 Replying to [comment:10 SirLouen]:
 > I'm not sure if this part is really necessary:
 > {{{
 > if ( is_wp_error( $post_id ) ) {
 >       wp_die( $post_id->get_error_message() );
 > }
 > }}}

 Don't you need that though?  That's the actual check to see whether the
 `wp_insert_post()` call failed.  Without that, the code is just going to
 keep running (and presumably crash at some later point).

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


More information about the wp-trac mailing list