[wp-trac] [WordPress Trac] #64813: Docs: Fix `@param` type for `get_posts()` and other functions using `wp_parse_args()`
WordPress Trac
noreply at wordpress.org
Tue Mar 10 14:06:32 UTC 2026
#64813: Docs: Fix `@param` type for `get_posts()` and other functions using
`wp_parse_args()`
-------------------------------+--------------------------
Reporter: rodrigosprimo | Owner: westonruter
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 7.0
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: docs
-------------------------------+--------------------------
Comment (by rodrigosprimo):
Thanks for the review and for running the wpdirectory searches,
@westonruter. I'm happy to keep this ticket limited to adding `string` for
`get_posts()`.
Just a thought on the broader question: my understanding is that `@param`
types should describe what a function actually accepts, regardless of
whether we want to encourage a particular usage pattern. But I can see the
pragmatic argument for not documenting `object` here since it's not used
in practice. Is there an established practice around this in Core? I
wonder if an alternative approach could be to document the three accepted
types, `array|object|string`, but note in the parameter description that
passing an `object` is discouraged or something like that?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64813#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list