mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Docs: Clarify return results for a non-existing ID in metadata functions.
[48658] documented that various metadata functions return false for an invalid ID. However, that does not clarify what an invalid ID is: a non-numeric, zero, or negative value. This change adds the clarification in all relevant metadata function docblocks. Props icopydoc, SergeyBiryukov, davidkryzaniak, audrasjb. Fixes #51797. git-svn-id: https://develop.svn.wordpress.org/trunk@50641 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2236,10 +2236,12 @@ function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
|
||||
* @param string $key Optional. The meta key to retrieve. By default,
|
||||
* returns data for all keys. Default empty.
|
||||
* @param bool $single Optional. Whether to return a single value.
|
||||
* This parameter has no effect if $key is not specified.
|
||||
* This parameter has no effect if `$key` is not specified.
|
||||
* Default false.
|
||||
* @return mixed An array if $single is false. The value of the meta field
|
||||
* if $single is true. False for an invalid $post_id.
|
||||
* @return mixed An array of values if `$single` is false.
|
||||
* The value of the meta field if `$single` is true.
|
||||
* 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.
|
||||
*/
|
||||
function get_post_meta( $post_id, $key = '', $single = false ) {
|
||||
return get_metadata( 'post', $post_id, $key, $single );
|
||||
|
||||
Reference in New Issue
Block a user