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; }