From a03e393523b4e9078a741066f1c779d39d517768 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Wed, 29 Nov 2023 17:09:52 -0300 Subject: [PATCH] Make sure the queried object was found before using it --- includes/classes/Indexable/Post/QueryIntegration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/classes/Indexable/Post/QueryIntegration.php b/includes/classes/Indexable/Post/QueryIntegration.php index e383fa17df..89081e8025 100644 --- a/includes/classes/Indexable/Post/QueryIntegration.php +++ b/includes/classes/Indexable/Post/QueryIntegration.php @@ -256,7 +256,7 @@ public function get_es_posts( $posts, $query ) { * If not search and not set default to post. If not set and is search, use searchable post types */ if ( empty( $query_vars['post_type'] ) ) { - if ( $query->is_tax() ) { + if ( $query->is_tax() && $query->get_queried_object() ) { $query_vars['post_type'] = get_taxonomy( $query->get_queried_object()->taxonomy )->object_type; } elseif ( empty( $query_vars['s'] ) ) { $query_vars['post_type'] = 'post';