Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitimvata/09b177f8c822c8a2ffedf987058f0fe3 to your computer and use it in GitHub Desktop.
Save fitimvata/09b177f8c822c8a2ffedf987058f0fe3 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Fix woocommerce admin analytics performance issue
* Plugin URI:
* Description:
* Version: 1.0.0
* Author:
* Author URI:
* License: MIT
*/
add_filter('posts_where', function ($where, WP_Query $wp_query) {
if ($wp_query->get('low_in_stock')) {
$wp_query->set('low_in_stock', false);
}
return $where;
}, 9, 3);
@rickdroio
Copy link

Thanks!! worked like a charm!! low stock query was blocking my website!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment