Make WordPress Core

Changeset 52258


Ignore:
Timestamp:
11/27/2021 03:22:17 PM (3 years ago)
Author:
audrasjb
Message:

Taxonomy: Check $term object before using it in get_term_feed_link().

This change performs the type safety check on $term before it is used to retrieve the taxonomy in get_term_feed_link(). It also updates the related DocBlock after [52255].

Follow up to [52255].

Props dlh.
Fixes #50225.

File:
1 edited

Legend:

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

    r52255 r52258  
    924924 * @param int|WP_Term|object $term     The ID or term object whose feed link will be retrieved.
    925925 * @param string             $taxonomy Optional. Taxonomy of `$term_id`.
    926  *                                     Defaults to 'category' if term ID or non WP_Term object is passed.
    927926 * @param string             $feed     Optional. Feed type. Possible values include 'rss2', 'atom'.
    928927 *                                     Default is the value of get_default_feed().
     
    936935    $term = get_term( $term, $taxonomy );
    937936
    938     $taxonomy = $term->taxonomy;
    939 
    940937    if ( empty( $term ) || is_wp_error( $term ) ) {
    941938        return false;
    942939    }
     940
     941    $taxonomy = $term->taxonomy;
    943942
    944943    if ( empty( $feed ) ) {
Note: See TracChangeset for help on using the changeset viewer.