• Resolved phalancs

    (@phalancs)


    I dont want the menu item to be labelled as “flamingo” cause mny client will not understand what and why it is calle dlike that, nor makes it any sense. Something like “Adressbook”, or “Contacts” would be much more convenient.

    How can one acchieve this? Thanks in advance.

    • This topic was modified 7 years, 10 months ago by phalancs.
Viewing 5 replies - 1 through 5 (of 5 total)
  • With the menu editor plugin you can modify it and place the name you want

    eliana

    Thread Starter phalancs

    (@phalancs)

    Thanks but I thought such a plugin would be little too much for this. I thought line in the functions.php could do the trick.

    No I just edited the plugin file… Hmm. At least a solution for now ??

    Wilco

    (@wilcodeveloper)

    I found a solution for this problem.
    You can put this function in your functions.php

    if (!function_exists('debug_admin_menus')):
    function debug_admin_menus() {
        global $submenu, $menu, $pagenow;
        if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN
            if( $pagenow == 'index.php' ) {  // PRINTS ON DASHBOARD
                echo '<pre>'; print_r( $menu ); echo '</pre>'; // TOP LEVEL MENUS
                echo '<pre>'; print_r( $submenu ); echo '</pre>'; // SUBMENUS
            }
        }
    }
    add_action( 'admin_notices', 'debug_admin_menus' );
    endif;

    This displays the complete wordpress admin menu on your dashboard for admin only.
    You scroll down in this list (which looks like this https://postimg.org/image/az7bpv8mh/)
    until you see Flamingo. in my case its number 26.
    you head back to functions.php and paste this function:

    function menu_page_removal() {
    
        global $menu;
    
        // Rename flamingo into Submissions
        $menu[26][0] = __('Submissions','textdomain');
    
    }
    add_action( 'admin_menu', 'menu_page_removal' , 999);

    Save your functions and take a look in your dashboard.
    Flamingo should be renamed to Submissions.

    If everything works correct you can remove the first function debug_admin_menus , since its only for debugging.
    This works for most other menu items as well

    Good luck

    • This reply was modified 7 years, 10 months ago by Wilco.
    Thread Starter phalancs

    (@phalancs)

    Thank you! Guided me into the right direction. Here is an even simpler and generic solution to naming weirdness:

    function rename_flamingo() {
        
        global $menu;
        
        foreach($menu as $key => $item) {
          if ( $item[0] === 'Flamingo' ) {
              $menu[$key][0] = __('Anfragen','textdomain');     //change name
              $menu[$key][3] = __('Adressbuch','textdomain');   //does not work but should (needs another hook?)  
              $menu[$key][6] = __('dashicons-id','textdomain'); //change icon
          }
        }
       return false;
    }
    add_action( 'admin_menu', 'rename_flamingo', 999 );
    
    
    • This reply was modified 7 years, 6 months ago by phalancs.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Rename Menu item’ is closed to new replies.