[wp-trac] [WordPress Trac] #63802: Incorrect @return tag in doc comment for get_post_field()
WordPress Trac
noreply at wordpress.org
Fri Aug 8 20:00:45 UTC 2025
#63802: Incorrect @return tag in doc comment for get_post_field()
-------------------------------+-----------------------------
Reporter: marian1 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version:
Severity: minor | Keywords:
Focuses: docs |
-------------------------------+-----------------------------
`get_post_field()` either returns an empty string or the sanitised post
field value via `sanitize_post_field()`.
Although the documented return type is `string`, the actual return value
and type depend on the requested post field. For example,
`get_post_field('post_parent', $post_id)` returns an integer value.
To align the documentation with the actual behaviour, I suggest updating
the `@return` tag to either `mixed` (as documented for
`sanitize_post_field()`) or specifying the union of all possible return
types.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63802>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list