Problems ordering by date in a product category
-
when I have a category with a custom order, the pre_get_posts that is done, disables the ability to sort by date.
I have solved it by including this in the plugin:
public function sort_products_by_category( $query ) { if( isset( $_GET['orderby'] ) && $_GET['orderby'] == 'date' ) return; if ( ( is_product_category() || is_product_tag() ) && $query->is_main_query() && ! is_admin() ) {
But of course, aside from not wanting to touch the plugin, I’m sure you have a much more elegant way to do it within your own plugin.
Thank you very much.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Problems ordering by date in a product category’ is closed to new replies.