Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55249 closed defect (bug) (fixed)

Incorrect return type documented for get_post_custom()

Reported by: chouby's profile Chouby Owned by: audrasjb's profile audrasjb
Milestone: 6.0 Priority: normal
Severity: trivial Version: 1.2
Component: Posts, Post Types Keywords: has-patch
Focuses: docs Cc:


In the doc block of get_post_custom(), we can read that it always return an array. This is incorrect. As the return value is directly coming from get_post_meta(), the function can return, according to the doc of get_post_meta()

  • An array of values
  • False for an invalid $post_id (non-numeric, zero, or negative value).
  • An empty string if a valid but non-existing post ID is passed.

Change History (4)

#1 @audrasjb
2 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.0
  • Owner set to audrasjb
  • Status changed from new to reviewing

Hey thanks for spotting this @Chouby,
Self-assigning for review and milestoning to 6.0.

This ticket was mentioned in PR #2356 on WordPress/wordpress-develop by audrasjb.

2 years ago

  • Keywords has-patch added; needs-patch removed

#3 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52795:

Docs: Correct return type for get_post_custom().

Props chouby, audrasjb.
Fixes #55249.
See #54729.

Note: See TracTickets for help on using tickets.