[wp-trac] [WordPress Trac] #37441: get_default_post_to_edit() function is broken
WordPress Trac
noreply at wordpress.org
Mon Sep 1 12:24:14 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 needs-testing | administration
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-test-info good-first-bug has-patch has-unit-tests => has-
test-info good-first-bug has-patch has-unit-tests needs-testing
Comment:
Replying to [comment:15 siliconforks]:
> 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.
Yes, you are correct. Obviously for compatibility, this is how it is. But
I wonder if it would have been better to fail fast directly inside the
call, instead of returning the error, and expecting the caller to fail
after this. It's like forcing every single call to `wp_insert_post` (and
many other functions), to add a failover afterward forcefully (which has
not been done throughout the code as we can see in this report)
Replying to [comment:16 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.
Great then, I think we are ready to move on here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37441#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list