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. Built from https://develop.svn.wordpress.org/trunk@50565 git-svn-id: http://core.svn.wordpress.org/trunk@50178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3bd08d3bd4
commit
d5a6a1ab44
|
@ -1118,7 +1118,7 @@ class WP_Query {
|
|||
'field' => 'slug',
|
||||
);
|
||||
|
||||
if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
|
||||
if ( ! empty( $t->rewrite['hierarchical'] ) ) {
|
||||
$q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] );
|
||||
}
|
||||
|
||||
|
|
|
@ -4475,7 +4475,7 @@ function get_term_link( $term, $taxonomy = '' ) {
|
|||
}
|
||||
$termlink = home_url( $termlink );
|
||||
} else {
|
||||
if ( $t->rewrite['hierarchical'] ) {
|
||||
if ( ! empty( $t->rewrite['hierarchical'] ) ) {
|
||||
$hierarchical_slugs = array();
|
||||
$ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' );
|
||||
foreach ( (array) $ancestors as $ancestor ) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-alpha-50564';
|
||||
$wp_version = '5.8-alpha-50565';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue