From df9543000b0b2701f04862f9772a9d31af4a6096 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 30 May 2014 16:22:32 +0100 Subject: [PATCH] Optimise report query --- includes/admin/reports/class-wc-admin-report.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/includes/admin/reports/class-wc-admin-report.php b/includes/admin/reports/class-wc-admin-report.php index aa66c0814a4..7da9e458132 100644 --- a/includes/admin/reports/class-wc-admin-report.php +++ b/includes/admin/reports/class-wc-admin-report.php @@ -88,9 +88,6 @@ class WC_Admin_Report { // Joins $joins = array(); - $joins['rel'] = "LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID"; - $joins['tax'] = "LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )"; - $joins['term'] = "LEFT JOIN {$wpdb->terms} AS term USING( term_id )"; foreach ( $data as $key => $value ) { if ( $value['type'] == 'meta' ) { @@ -132,9 +129,7 @@ class WC_Admin_Report { $query['where'] = " WHERE posts.post_type = 'shop_order' - AND posts.post_status = 'publish' - AND tax.taxonomy = 'shop_order_status' - AND term.slug IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "') + AND posts.post_status IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'complete', 'processing', 'on-hold' ) ) ) . "') "; if ( $filter_range ) {