Created
August 8, 2020 03:06
-
-
Save wpmudev-sls/fd09e47acab84d579f4a8eebdec916f5 to your computer and use it in GitHub Desktop.
[Woo Performance] Disable net sales status on the Dashboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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