Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 8 months ago

#55249 closed defect (bug) (fixed)

Incorrect return type documented for get_post_custom()

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

Description

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 (5)

#1 @audrasjb
5 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → 6.0
  • Owner set to audrasjb
  • Status new → 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.


5 years ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @audrasjb
5 years ago

  • Resolution → fixed
  • Status reviewing → closed

In 52795:

Docs: Correct return type for get_post_custom().

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

#5 @westonruter
8 months ago

In 61718:

Docs: Improve accuracy of @return type and description for get_post_custom().

Developed in ​https://github.com/WordPress/wordpress-develop/pull/10996

Follow-up to [52795].

Props ravikhadka, westonruter, swissspidy, roytanck.
See #64224, #55249.
Fixes #60646.

Note: See TracTickets for help on using tickets.