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/taxonomy.php

    r58427 r58962  
    14311431 *               The value of the meta field if `$single` is true.
    14321432 *               False for an invalid `$term_id` (non-numeric, zero, or negative value).
    1433  *               An empty string if a valid but non-existing term ID is passed.
     1433 *               An empty array if a valid but non-existing term ID is passed and `$single` is false.
     1434 *               An empty string if a valid but non-existing term ID is passed and `$single` is true.
    14341435 */
    14351436function get_term_meta( $term_id, $key = '', $single = false ) {
Note: See TracChangeset for help on using the changeset viewer.