Merge pull request #18883 from woocommerce/fix/18881

If using get_catalog_ordering_args. remove the args when finsihed
This commit is contained in:
Claudiu Lodromanean 2018-02-08 09:31:11 -08:00 committed by GitHub
commit 2b96d68047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -444,6 +444,7 @@ class WC_Template_Loader {
// Remove actions and self to avoid nested calls.
remove_action( 'pre_get_posts', array( wc()->query, 'product_query' ) );
WC()->query->remove_ordering_args();
}
self::$in_content_filter = false;

View File

@ -525,10 +525,8 @@ class WC_Shortcode_Products {
set_transient( $transient_name, $results, DAY_IN_SECONDS * 30 );
}
}
// Remove ordering query arguments.
if ( ! empty( $this->attributes['category'] ) ) {
WC()->query->remove_ordering_args();
}
// Remove ordering query arguments which may have been added by get_catalog_ordering_args.
WC()->query->remove_ordering_args();
return $results;
}