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 wpmudev-sls/fd09e47acab84d579f4a8eebdec916f5 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/fd09e47acab84d579f4a8eebdec916f5 to your computer and use it in GitHub Desktop.
[Woo Performance] Disable net sales status on the Dashboard.
<?php
/**
* Plugin Name: [Woo Performance] Disable net sales status on the Dashboard.
* Description: [Woo Performance] Disable net sales status on the Dashboard.
* Jira: SLS-468
* Author: Thobk @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
// https://monosnap.com/file/BdDKnuqAofRyKVXZWpugePVmLUjCaI
add_action( 'wp_dashboard_setup', 'wpmudev_woo_disable_net_sales_status_on_dashboard', 9);
function wpmudev_woo_disable_net_sales_status_on_dashboard(){
add_filter( 'user_has_cap', function( $all_caps, $caps, $args ){
if( $args[0] === 'view_woocommerce_reports' && isset( $all_caps['view_woocommerce_reports'] ) ){
unset( $all_caps['view_woocommerce_reports'] );
}
return $all_caps;
}, 10, 3 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment