WordPress.org

Make WordPress Core

Ticket #45163: 45163.patch

File 45163.patch, 1.3 KB (added by esoj, 19 months ago)

A simplified approach and updated documentation.

  • src/wp-includes/taxonomy.php

     
    913913 * @since 2.3.0
    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.
    916917 *
    917918 * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
    918919 *
    919  * @param string     $field    Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id'
     920 * @param string     $field    Either 'slug', 'name', 'id' (term_id or ID), or 'term_taxonomy_id'
    920921 * @param string|int $value    Search for this term value
    921922 * @param string     $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'.
    922923 * @param string     $output   Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     
    941942                }
    942943        }
    943944
    944         if ( 'id' === $field || 'term_id' === $field ) {
     945        if ( 'id' === $field || 'term_id' === $field || 'ID' === $field ) {
    945946                $term = get_term( (int) $value, $taxonomy, $output, $filter );
    946947                if ( is_wp_error( $term ) || null === $term ) {
    947948                        $term = false;