• In “Profile Edit” section, in which file do “Google+” and “Twitter username (without @)” variables located ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can add additional fields to the user profile using the user_contactmethods filter.

    add_filter( 'user_contactmethods', 'update_contact_methods',10,1);
    function update_contact_methods( $fields ) {
        $fields['twitter'] = 'Twitter Username';
        $fields['google_plus'] = 'Google Plus Username';
    
       return $fields;
    }

    To get the data from these fields using the get_the_author_meta function.

    <?php echo get_the_author_meta( 'twitter' ); ?>
    Used inside the loop with print out the authors twitter username.

    Thread Starter jackmichael

    (@jackmichael)

    Thanks Chris for your answer, I’m not looking for adding additional fields I’m actually willing to Change/Remove these two (not to hide)

    I didn’t even realize that the Twitter and Google plus fields had been added. I was giving you instructions on how to add fields that already existed.

    You can use the above technique to add any additional user contact methods. To remove or change one of the fields you can use the same hook. This code sample removes the Twitter and Google Plus. If you want to change them you first use the unset method then re add as I describe in the above post.

    add_filter( 'user_contactmethods', 'update_contact_methods',10,1);
    function update_contact_methods( $contactmethods ) {
        unset($contactmethods['twitter']);
        unset($contactmethods['googleplus']); 
    
        return $contactmethods;
    }
    Thread Starter jackmichael

    (@jackmichael)

    Thank you very much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Profile edit options’ is closed to new replies.