mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 21:30:26 +00:00
Make sure the queried object is non-null before accessing its properties.
Props markoheijnen, ryan. Fixes #21394. git-svn-id: https://develop.svn.wordpress.org/trunk@25310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -465,7 +465,7 @@ function wp_list_categories( $args = '' ) {
|
||||
|
||||
if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
|
||||
$current_term_object = get_queried_object();
|
||||
if ( $r['taxonomy'] == $current_term_object->taxonomy )
|
||||
if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy )
|
||||
$r['current_category'] = get_queried_object_id();
|
||||
}
|
||||
|
||||
@@ -1037,10 +1037,12 @@ function tag_description( $tag = 0 ) {
|
||||
* @return string Term description, available.
|
||||
*/
|
||||
function term_description( $term = 0, $taxonomy = 'post_tag' ) {
|
||||
if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
|
||||
if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
|
||||
$term = get_queried_object();
|
||||
$taxonomy = $term->taxonomy;
|
||||
$term = $term->term_id;
|
||||
if ( $term ) {
|
||||
$taxonomy = $term->taxonomy;
|
||||
$term = $term->term_id;
|
||||
}
|
||||
}
|
||||
$description = get_term_field( 'description', $term, $taxonomy );
|
||||
return is_wp_error( $description ) ? '' : $description;
|
||||
|
||||
Reference in New Issue
Block a user