Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For a project I'm working on, I want to change the labels of the 'Nickname' and 'Biographical Info' fields on edit profile (user-edit.php) page in the dashboard. I still want to use those fields as they are, I only want to change the labels. Anyone know of a function that can do this?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Every string goes through translate(), which uses the gettext filter. This mean you can try something like this:

add_filter( 'gettext', 'wpse6096_gettext', 10, 2 );
function wpse6096_gettext( $translation, $original )
{
    if ( 'Nickname' == $original ) {
        return 'Funny name';
    }
    if ( 'Biographical Info' == $original ) {
        return 'Resume';
    }
    return $translation;
}

It's probably even more efficient if you only call the add_filter when you are on the user-edit.php page (see the admin_head-user-edit.php hook or something like that).

share|improve this answer
    
thanks...this works great. using it for the time being. –  John Chandler Dec 31 '10 at 20:38

I am late with answer, but here is my take anyway. Slight differences and that selective filter add.

add_action('admin_head-user-edit.php', 'setup_user_edit');

function setup_user_edit() {

    add_filter('gettext', 'change_profile_labels');
}

function change_profile_labels($input) {

    if ('Nickname' == $input)
        return 'Nickname replacement';

    if ('Biographical Info' == $input)
        return 'Biographical Info replacement';

    return $input;
}
share|improve this answer
    
Thanks! This works...almost. It changes the labels when an admin is viewing another user but it doesn't change the labels when a user is editing their own profile. Is there a different function to use other than 'admin_head-user-edit.php' –  John Chandler Dec 31 '10 at 20:34
    
@John Chandler admin_head-user-edit.php is not a function, but hook with dynamically generated name. So if you want this to run on more pages, hook it to more admin_head-hooks, appending suffixes accordingly. –  Rarst Dec 31 '10 at 20:55
    
Thx. Still getting used to work with functions and learning all the language. –  John Chandler Dec 31 '10 at 21:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.