Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/92cd5de8f8c2af8759ea4f64a72bd240 to your computer and use it in GitHub Desktop.
Save barryhughes/92cd5de8f8c2af8759ea4f64a72bd240 to your computer and use it in GitHub Desktop.
"Nullify" the top seller query, within the WooCommerce Status dashboard widget (might be helpful, until such time as the query results are cached).
<?php
/**
* The top-seller query (used for the WooCommerce Status dashboard widget)
* runs on every dashboard request.
*
* It can effectively be nullified using this snippet, if the performance
* impact is too great.
*
* (Tested with WC 8.0.2)
*/
add_filter( 'woocommerce_dashboard_status_widget_top_seller_query', function () {
return [ 'SELECT NULL' ];
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment