Since the release of WooCommerce 4.3.x
, the previous fix for removing the Marketing menu option that worked with 4.1.x
does not work anymore and I’m wondering if anyone knows how to remove it for 4.3.x
.
I’ve tried all of these without success:
#1:
add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );
#2:
add_action( 'admin_init', 'remove_wc_marketing_menu_item' );
function remove_wc_marketing_menu_item() {
remove_menu_page( 'admin.php?page=wc-admin&path=/marketing' );
}
#3:
add_action( 'admin_init', 'remove_wc_marketing_menu_item' );
function remove_wc_marketing_menu_item() {
remove_menu_page( 'wc-admin&path=/marketing' );
}
#4:
add_filter( 'woocommerce_marketing_menu_items', 'remove_wc_marketing_menu_item' );
function remove_wc_marketing_menu_item( $marketing_pages ) {
return array();
}
None of them work with the latest WP and WC. I have no other plugins installed and I’m not using a customized child theme or anything like that.
All ideas are welcome.
2
Answers
The FeaturePlugin.php contains on line 292-301
So you get: (Tested in WooCommerce 4.3.1 version)
Source: https://gist.github.com/isaumya/89f48dcd84cb58af1e668bb76ba2c029 – https://github.com/woocommerce/woocommerce-admin/issues/4716
Available as a plugin: https://wordpress.org/plugins/disable-dashboard-for-woocommerce/
remove_menu_page( ‘woocommerce-marketing’ );