[wp-trac] [WordPress Trac] #63975: wp_delete_auto_drafts passes post type as string instead of as int
WordPress Trac
noreply at wordpress.org
Mon Sep 15 12:51:31 UTC 2025
#63975: wp_delete_auto_drafts passes post type as string instead of as int
-----------------------------------------+------------------------------
Reporter: kkmuffme | Owner: kkmuffme
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 3.4
Severity: trivial | Resolution:
Keywords: has-patch changes-requested | Focuses:
-----------------------------------------+------------------------------
Comment (by siliconforks):
Replying to [comment:2 SirLouen]:
> What is weirder for me, is the force conversion to an array of
`$old_posts` as `get_col` is always an array according to the phpdoc
definition.
`foreach ( (array) ...` is a very common PHP idiom - it is used several
hundred times throughout the WordPress codebase:
{{{
$ grep 'foreach *( *( *array' -r wordpress-develop/src | wc -l
334
}}}
Many people probably write it that way out of habit (even for situations
like this one where it does not actually do anything, since `$old_posts`
should always be an array).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63975#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list