Make WordPress Core

Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#40519 closed enhancement (fixed)

Document that get_metadata() returns false for bad parameters

Reported by: salcode's profile salcode Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version: 4.8
Component: Options, Meta APIs Keywords: has-patch needs-refresh
Focuses: docs Cc:

Description

Currently the inline documentation for the return value for get_metadata() reads

@return mixed Single metadata value, or array of values

I've noticed that if you pass in a post id of zero, you get a value of false. While the value of false falls under the category of "mixed", I would like to see it mentioned explicitly.

If we make this change, we should do the same for any function that uses get_metadata(), e.g. get_post_meta()

Attachments (1)

40519.diff (4.2 KB) - added by salcode 8 years ago.

Download all attachments as: .zip

Change History (6)

@salcode
8 years ago

#1 @salcode
8 years ago

  • Keywords has-patch added

Here is the [GitHub branch](https://github.com/salcode/wordpress-develop/tree/sf/get-metadata-doc-40519) where I've made this change.

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


5 years ago

#3 @kirasong
5 years ago

  • Component changed from General to Options, Meta APIs
  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

Hi @salcode!

Apologies for the very slow reply on this, and thanks much for your work and patch.

We chatted about this ticket in today's ticket triage.

It looks like these changes would still help make the documentation clearer, but unfortunately the patch doesn't apply anymore.

If you, or anyone else, has a chance to refresh the patch, it would be much appreciated.

#4 @johnbillion
5 years ago

  • Milestone changed from Future Release to 5.5
  • Resolution set to fixed
  • Status changed from new to closed

This was fixed in [48192] and [48411].

#5 @SergeyBiryukov
5 years ago

In 48658:

Docs: Document that various metadata functions return false for an invalid ID.

Props salcode.
See #40519.

Note: See TracTickets for help on using tickets.