Title: Bug in pre_get_posts function
Last modified: March 21, 2024

---

# Bug in pre_get_posts function

 *  Resolved [michaeljansse](https://wordpress.org/support/users/michaeljansse/)
 * (@michaeljansse)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/bug-in-pre_get_posts-function/)
 * I found a bug in the plugin that causes sorting by products in a category not
   to work on the website.
 * In the file rearrange-woocommerce-products.php on line 393 is says:
 * `if (is_tax('product_cat') && $query->is_main_query() && !is_admin()) {`
 * But this is not working. I can fix this issue by replacing this line with:
 * `if (is_tax('product_cat') && !is_admin()) {`
 * Is this maybe something you can look into? Because I see a few topics that also
   mention this issue.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Aslam Doctor](https://wordpress.org/support/users/aslamdoctor/)
 * (@aslamdoctor)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/bug-in-pre_get_posts-function/#post-17794868)
 * [@michaeljansse](https://wordpress.org/support/users/michaeljansse/) sorry to
   get back to you late but I have now implemented a plugin setting which will allow
   you to update all loops instead of just main query loop.
 *  Thread Starter [michaeljansse](https://wordpress.org/support/users/michaeljansse/)
 * (@michaeljansse)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/bug-in-pre_get_posts-function/#post-17839217)
 * [@aslamdoctor](https://wordpress.org/support/users/aslamdoctor/) Excelent! Thank
   you for getting back to me on this!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug in pre_get_posts function’ is closed to new replies.

 * ![](https://ps.w.org/rearrange-woocommerce-products/assets/icon-256x256.png?rev
   =3421674)
 * [Rearrange Products for WooCommerce](https://wordpress.org/plugins/rearrange-woocommerce-products/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rearrange-woocommerce-products/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rearrange-woocommerce-products/)
 * [Active Topics](https://wordpress.org/support/plugin/rearrange-woocommerce-products/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rearrange-woocommerce-products/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rearrange-woocommerce-products/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [order](https://wordpress.org/support/topic-tag/order/)

 * 2 replies
 * 2 participants
 * Last reply from: [michaeljansse](https://wordpress.org/support/users/michaeljansse/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/bug-in-pre_get_posts-function/#post-17839217)
 * Status: resolved