Make WordPress Core


Ignore:
Timestamp:
09/01/2024 06:28:22 PM (5 weeks ago)
Author:
SergeyBiryukov
Message:

Docs: Further clarify return results for a non-existing ID in metadata functions.

This adds a note that the functions return either an empty array or an empty string for a valid but non-existing ID, depending on the $single parameter.

Follow-up to [48658], [50641].

Props rodrigosprimo, jrf.
See #61608.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r58849 r58962  
    26082608 *               The value of the meta field if `$single` is true.
    26092609 *               False for an invalid `$post_id` (non-numeric, zero, or negative value).
    2610  *               An empty string if a valid but non-existing post ID is passed.
     2610 *               An empty array if a valid but non-existing post ID is passed and `$single` is false.
     2611 *               An empty string if a valid but non-existing post ID is passed and `$single` is true.
    26112612 */
    26122613function get_post_meta( $post_id, $key = '', $single = false ) {
Note: See TracChangeset for help on using the changeset viewer.