WordPress.org

Ready to get started?Download WordPress

Forums

Profile edit options (5 posts)

  1. jackmichael
    Member
    Posted 1 year ago #

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

  2. 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.

  3. jackmichael
    Member
    Posted 1 year ago #

    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)

  4. 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;
    }
  5. jackmichael
    Member
    Posted 1 year ago #

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.