Issues with WooCommerce
-
I could not get this to work with WooCommerce Product Categories. I thought maybe because the sorting was not set to ‘menu_order’ but even setting that in
pre_get_posts
didn’t seem to change anything./** * Front-end Query Modifications * * @param WP_Query $query * * @return void */ function prefix_pgp( $query ) { if( is_admin() ) { return; } if( $query->is_main_query() ) { // Custom Product Order if( $query->is_post_type_archive( 'product' ) || $query->is_tax( 'product_cat' ) && empty( $_GET['orderby'] ) ) { $query->set( 'orderby', array( 'menu_order' => 'ASC', 'post_date' => 'ASC' ) ); } } } add_action( 'pre_get_posts', 'prefix_pgp' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Issues with WooCommerce’ is closed to new replies.