如何在WordPress管理仪表板上的WooCommerce选项卡下重命名菜单选项卡 [英] How to rename a menu tab under WooCommerce tab on WordPress admin dashboard

查看:155
本文介绍了如何在WordPress管理仪表板上的WooCommerce选项卡下重命名菜单选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在重命名wordpress管理员的woocommerce选项卡下的选项卡菜单项时,我需要帮助.我们安装了一个插件,该插件在woocommerce选项卡上显示为子菜单.有人可以帮我吗?

I need help in renaming a tab menu item under woocommerce tab on wordpress admin. We installed a plugin that appears as a submenu on woocommerce tab. Can anyone please help me on this?

我在下面找到了这段代码来重命名选项卡菜单,但是我不知道它的选项卡键是什么.还是这里的任何人如何在我当前的标签菜单项上检查标签菜单键?

I found this code below to rename a tab menu, but I dont know what is the tabmenu key of it. Or anyone here how to check tab menu key on my current tab menu items?

add_action( 'admin_menu', 'custom_change_admin_label', 99);
function custom_change_admin_label() {
    global $menu;
    //global $submenu;
    $menu[5][0] = 'Articles';
}

谢谢

推荐答案

代码的第一部分调试,这将向您显示菜单详细信息. (您可以在以后将其删除)

The first part of the code is to debug, this will show you the menu in detail on the dashboard. (you can remove this afterwards)

此示例中的第二部分将优惠券" 标签更改为优惠券"

The 2nd part in this example changes the 'coupons' label to 'voucher'

因此,需要根据细节进行调整

It is therefore a matter of adjusting based on the detail

// DEBUG: This displays the complete wordpress admin menu on your dashboard for admin only.
function debug_admin_menus() {
    global $menu, $submenu, $pagenow;
    if ( current_user_can('manage_options') ) {
        if( $pagenow == 'index.php' ) {  // print on dashboard
            echo '<pre>', print_r( $menu, 1 ), '</pre>'; // top level menus
            echo '<pre>', print_r( $submenu, 1 ), '</pre>'; // submenus
        }
    }
}
add_action( 'admin_notices', 'debug_admin_menus' );

// Change label, in this example changes the 'coupons' label to 'voucher'
function custom_change_admin_label() {
    global $menu, $submenu;

    $submenu['woocommerce'][2][0] = 'Voucher'; // rename 'coupons' label
}
add_action( 'admin_menu', 'custom_change_admin_label' );

这篇关于如何在WordPress管理仪表板上的WooCommerce选项卡下重命名菜单选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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