Make WordPress Core


Ignore:
Timestamp:
03/23/2021 01:53:50 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Taxonomy: Use a consistent check for the $rewrite['hierarchical'] parameter.

This avoids a "Trying to access array offset on value of type bool" PHP warning in get_term_link() if the $rewrite parameter of register_taxonomy() is set as false.

Props Tkama, SergeyBiryukov.
Fixes #52882.

File:
1 edited

Legend:

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

    r50562 r50565  
    44764476        $termlink = home_url( $termlink );
    44774477    } else {
    4478         if ( $t->rewrite['hierarchical'] ) {
     4478        if ( ! empty( $t->rewrite['hierarchical'] ) ) {
    44794479            $hierarchical_slugs = array();
    44804480            $ancestors          = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' );
Note: See TracChangeset for help on using the changeset viewer.