php WooCommerce - 从我的帐户页面的菜单中删除下载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39287308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:51:00  来源:igfitidea点击:

WooCommerce - Remove downloads from menu in my account page

phpwordpresswoocommerceaccounthook-woocommerce

提问by techiva.blogspot.in

I would like to remove downloads menu from my account page.

我想从我的帐户页面中删除下载菜单。

How can I do this? Is it any hook to remove a specific item from the menu?

我怎样才能做到这一点?从菜单中删除特定项目是否有任何钩子?

Thanks.

谢谢。

回答by Christophvh

Go to WooCommerce > Settings > Advancedand remove the entry for Downloads in the Account endpointssection, just leave it blank. And the menu will not be visible anymore.

转到WooCommerce > Settings > Advanced并删除“帐户端点”部分中的“下载”条目,将其留空。菜单将不再可见。

remove downloads link

删除下载链接

回答by LoicTheAztec

You will need this lightly customized this code snippet:

您将需要这个稍微定制的代码片段:

function custom_my_account_menu_items( $items ) {
    unset($items['downloads']);
    return $items;
}
add_filter( 'woocommerce_account_menu_items', 'custom_my_account_menu_items' );

This code goes on function.php file of your active child theme (or theme) or in any plugin file.

此代码位于活动子主题(或主题)的 function.php 文件或任何插件文件中。

This code is tested and working

这段代码已经过测试并且可以正常工作

回答by Sean

[data-tab="downloads"] {
    display: none!important;
}