lse; } } return apply_filters( 'wpml_is_comment_query_filtered', $filtered, $post_id ); } /** * Adds a join with the posts table to the query only if necessary because the comment query is not filtered * by post variables * * @param WP_Comment_Query $comment_query * @return string */ private function get_comment_query_join( $comment_query ){ $posts_params = array( 'post_author', 'post_name', 'post_parent', 'post_status', 'post_type', 'post_author__not_in', 'post_author__in' ); $query_vars = isset( $comment_query->query_vars ) ? array_filter ( $comment_query->query_vars ) : array(); $plucked = wp_array_slice_assoc ( $query_vars, $posts_params ); $post_fields = array_filter ( $plucked ); $posts_query = !empty( $post_fields ); $join_part = $posts_query ? " AND " : "JOIN {$this->wpdb->posts} ON "; return $join_part; } /** * @param $requested_id * * @return bool|mixed|null|string */ private function get_current_language( $requested_id ) { $current_language = null; if ( $requested_id ) { $current_language = $this->post_translations->get_element_lang_code( $requested_id ); } if ( ! $current_language ) { $current_language = $this->sitepress->get_current_language(); } if ( ! $current_language ) { $current_language = $this->sitepress->get_default_language(); } return $current_language; } }