在WooCommerce 4.3.x中禁用(删除)市场营销菜单选项 [英] Disable (remove) the marketing menu option in WooCommerce 4.3.x

查看:192
本文介绍了在WooCommerce 4.3.x中禁用(删除)市场营销菜单选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自WooCommerce 4.3.x发布以来,先前用于删除与4.1.x一起使用的市场营销"菜单选项的修补程序不再起作用,我想知道是否有人知道如何为4.3.x删除它.

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();
}


它们都不与最新的WP和WC一起使用.我没有安装其他插件,也没有使用自定义的子主题或类似的东西.


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.

欢迎所有想法.

推荐答案

您将获得:(在WooCommerce 4.3.1版本中经过测试)

So you get: (Tested in WooCommerce 4.3.1 version)

function filter_woocommerce_admin_get_feature_config( $feature_config ) {   
    $feature_config['marketing'] = false;

    return $feature_config;
}
add_filter( 'woocommerce_admin_get_feature_config', 'filter_woocommerce_admin_get_feature_config', 10, 1 );


来源: https://gist.github.com/isaumya/89f48dcd84cb58af1e668bb76ba2c029 - https://github.com/woocommerce/woocommerce-admin/issues/4716

作为插件提供: https://wordpress.org/plugins/disable -dashboard-for-woocommerce/

这篇关于在WooCommerce 4.3.x中禁用(删除)市场营销菜单选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆