删除或隐藏“添加新"批量订单面板上 woocommerce 上的按钮 [英] Remove or hide "add new" button on woocommerce on bulk order panel

查看:41
本文介绍了删除或隐藏“添加新"批量订单面板上 woocommerce 上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此进行了大量搜索,但找不到我必须更改的文件.

我需要在 wordpress/woocommerce 仪表板上删除或隐藏此按钮,因为我不希望商店经理或其他用户执行此操作.这里有一些图片来解释我必须删除的内容.

I was searching a lot about this, but I can't find the file that I have to change.

I need to remove or hide this button on wordpress / woocommerce dashboard because I don't want shop manager or another users do this action. Here are some images to explain what I have to remove.

推荐答案

一个不错的选择是添加一些自定义 CSS 以隐藏针对有条件的用户角色功能的添加订单"按钮,在 admin_head<中挂钩的自定义函数中/code> 动作钩子:

A good alternative is to add some custom CSS to hide "Add Order" buttons targeting conditionally user roles capabilities, in a custom function hooked in admin_head action hook:

add_action( 'admin_head', 'my_custom_admin_styles' );
function my_custom_admin_styles() {

    // HIDE "New Order" button when current user don't have 'manage_options' admin user role capability
    if( ! current_user_can( 'manage_options' ) ):
    ?>
        <style>
            .post-type-shop_order #wpbody-content > div.wrap > a.page-title-action{
                display: none !important;
            }
        </style>
    <?php
    endif;
}

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

经过测试并完美运行.

这篇关于删除或隐藏“添加新"批量订单面板上 woocommerce 上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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