Make WordPress Core

Changeset 47870


Ignore:
Timestamp:
05/30/2020 10:06:49 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Adjust the documentation for the new ID alias in get_term_by() for consistency with get_user_by().

Follow-up to [47865].

See #45163.

File:
1 edited

Legend:

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

    r47865 r47870  
    914914 * @since 4.4.0 `$taxonomy` is optional if `$field` is 'term_taxonomy_id'. Converted to return
    915915 *              a WP_Term object if `$output` is `OBJECT`.
    916  * @since 5.5.0 ID is an alias of id.
     916 * @since 5.5.0 Added 'ID' as an alias of 'id' for the `$field` parameter.
    917917 *
    918918 * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
    919919 *
    920  * @param string     $field    Either 'slug', 'name', 'id' (term_id or ID), or 'term_taxonomy_id'
    921  * @param string|int $value    Search for this term value
     920 * @param string     $field    Either 'slug', 'name', 'id' or 'ID' (term_id), or 'term_taxonomy_id'.
     921 * @param string|int $value    Search for this term value.
    922922 * @param string     $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'.
    923923 * @param string     $output   Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     
    943943    }
    944944
    945     if ( 'id' === $field || 'term_id' === $field || 'ID' === $field ) {
     945    if ( 'id' === $field || 'ID' === $field || 'term_id' === $field ) {
    946946        $term = get_term( (int) $value, $taxonomy, $output, $filter );
    947947        if ( is_wp_error( $term ) || null === $term ) {
Note: See TracChangeset for help on using the changeset viewer.