Change WooCommerce products menu title in WordPress admin dashboard

前端 未结 1 1753
温柔的废话
温柔的废话 2020-12-12 01:42

We have tried to change the products page at the back end title menu but we couldn\'t using the snippet below in the screenshot:

We need to change both the

相关标签:
1条回答
  • 2020-12-12 02:26

    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 adds the changes

    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
    function custom_change_admin_label() {
        global $menu, $submenu;
    
        $menu[26][0] = 'New Title';
        $submenu['edit.php?post_type=product'][5][0] = 'All Submenu';
    }
    add_action( 'admin_menu', 'custom_change_admin_label' );
    
    0 讨论(0)
提交回复
热议问题