How to change the name of the “edit my profile” link in the WordPress admin backend

I am really confused at this point. I can not figure it out how to rename Edit My Profile link in the admin backend.

How can that be done?

Related posts

Leave a Reply

2 comments

  1. You could use the wp_before_admin_bar_render hook. You can play with code samples on the Codex page by putting them in your theme’s functions.php.

    First off you can try examining the object by outputting its contents with print_r(), and you’ll see all the familiar items. I would probably use remove_menu helper and then add a new one with the modified link title, just to keep things clean.

    add_action( 'wp_before_admin_bar_render', 'my_tweaked_admin_bar' ); 
    
    function my_tweaked_admin_bar() {
        global $wp_admin_bar;
    
        $wp_admin_bar->remove_menu('edit-profile');
    
        $wp_admin_bar->add_menu( array(
                'id'    => 'edit-profile',
                'title' => 'Edit Zee Profile',
                'href'  => admin_url('profile.php'),
                'parent'=>'user-actions'
            ));
    }
    

    The downside of this approach is that the new item will not show up in the same spot.

  2. If you want to alter strings from core code in the backend, a nifty way to get at ’em is by means of the gettext filter.

    This filter is applied by every internationalization function, i.e. for every translatable string.

    Even if your goal is renaming rather than translating, it does the trick:

    function wpse94377_change_admin_ui_text( $translation, $text ) {
        if( is_admin() && 'Edit My Profile' === $text ) {
            return 'Edit My Userdata';
        }
        return $translation;
    }
    add_filter( 'gettext', wpse94377_change_admin_ui_text, 10, 2 );
    

    Obviously you can also return another translatable string by using
    __( 'Edit My Userdata', 'your-text-domain' ) after the first return statement.