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

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

 Well, if you don't have the `is_wp_error()` check, presumably it's going
 to crash at some later point - but that may be confusing to someone trying
 to troubleshoot the problem, because it will be crashing on a line of code
 that isn't the actual line which caused the error.

 It might crash on the very next line (the `get_post()` line) - but that's
 still not the line where the original error actually occurred.

 The idea of the `is_wp_error()` check is to detect the error as soon as it
 occurs, then [https://en.wikipedia.org/wiki/Fail-fast_system fail fast]
 immediately.

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


More information about the wp-trac mailing list