From f11ffc3a439a3ee3f63f15b05de1d1b0d251eadd Mon Sep 17 00:00:00 2001 From: David Sword <1996370+davidsword@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:22:23 -0800 Subject: [PATCH] add filter to disable query logging addresses https://github.com/10up/ElasticPress/issues/4006 --- includes/classes/Elasticsearch.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/classes/Elasticsearch.php b/includes/classes/Elasticsearch.php index e5d139ac1..5fb5739d4 100644 --- a/includes/classes/Elasticsearch.php +++ b/includes/classes/Elasticsearch.php @@ -1735,7 +1735,8 @@ public function add_elasticpress_version_to_user_agent( $user_agent ) { * @param array $query Query to log. */ protected function add_query_log( $query ) { - if ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'WP_EP_DEBUG' ) && WP_EP_DEBUG ) ) { + $disable_logging = apply_filters( 'ep_disable_query_logging', false ); + if ( ! $disable_logging && ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'WP_EP_DEBUG' ) && WP_EP_DEBUG ) ) ) { $this->queries[] = $query; }