Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8332927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:51:41+00:00 2026-06-09T02:51:41+00:00

I am having an issue with adding custom fields to the wordpress user profile

  • 0

I am having an issue with adding custom fields to the wordpress user profile and having the inputted fields show on the front of the site. Using the below tutorial I thought I had it working, however noticed that actually it only works for ONE user, then all of the others don’t work, this is what is confusing me as I am used to things either working, or not working, whereas this works for the first user I tried it for, but no others.

I have looked high and low trying different things to no avail.

My purpose for this is to allow multiple wordpress users to add their Google+ profile to the wordpress head on posts BY that specific author with the rel attribute.

Here is the tutorial I have used

http://bavotasan.com/2009/adding-extra-fields-to-the-wordpress-user-profile/

Here is the code I am using for the function

1 – This adds the field to the user profile

/* Add Additional Fields to Author Profile */

add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );

function my_show_extra_profile_fields( $user ) { ?>

    <h3>Extra profile information</h3>

    <table class="form-table">

        <tr>
            <th><label for="u-profs">Profile Info</label></th>

            <td>
                <input type="text" name="u-profs" id="u-profs" value="<?php echo esc_attr( get_the_author_meta( 'u-profs', $user->ID ) ); ?>" class="regular-text" /><br />
                <span class="description">Enter Your Profile Info.</span>
            </td>
            <td>
                <input type="text" name="u-profs2" id="u-profs2" value="<?php echo esc_attr( get_the_author_meta( 'u-profs2', $user->ID ) ); ?>" class="regular-text" /><br />
                <span class="description">Enter Your Google+ Url.</span>
            </td>
        </tr>

    </table>
<?php }

add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );

foreach($user_ids as $user_id){
    update_user_meta( $user_id, 'u-profs2', $_POST['u-profs2'] );
}

function my_save_extra_profile_fields( $user_id ) {

    if ( !current_user_can( 'edit_user', $user_id ) )
        return false;

    /* Copy and paste this line for additional fields. Make sure to change 'u-profs' to the field ID. */
    update_user_meta( $user_id, 'u-profs', $_POST['u-profs'] );
    update_user_meta( $user_id, 'u-profs2', $_POST['u-profs2'] );
}

2 – This gets the field content and adds it to the wp_head of wordpress

    /* Google Rel Author */

function google_rel_author_in_document_head() {
echo '<link rel="author" href="' . get_the_author_meta('u-profs2') . '"/>';
}
add_action('wp_head', 'google_rel_author_in_document_head',99);

This link on StackOverflow seems to be a similar problem but is unresolved…

Multiple update_user_meta in WordPress

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:51:42+00:00Added an answer on June 9, 2026 at 2:51 am

    Right I found the working code in the end…

    /* Add Additional Fields to Author Profile */
    
    add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
    
    function my_show_extra_profile_fields( $user ) { ?>
    
        <h3>Extra profile information</h3>
    
        <table class="form-table">
    
            <tr>
                <th><label for="u-profs">Profile Info</label></th>
                <td>
                    <input type="text" name="u-profs2" id="u-profs2" value="<?php echo esc_attr( get_the_author_meta( 'u-profs2', $user->ID ) ); ?>" class="regular-text" /><br />
                    <span class="description">Enter Your Google+ Url.</span>
                </td>
            </tr>
    
        </table>
    <?php }
    
    add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    
    function my_save_extra_profile_fields( $user_id ) {
    
        if ( !current_user_can( 'edit_user', $user_id ) )
            return false;
    
        /* Copy and paste this line for additional fields. Make sure to change 'u-profs' to the field ID. */
        update_user_meta( $user_id, 'u-profs2', $_POST['u-profs2'] );
    }
    
    /* Google Rel Author */
    
    function google_rel_author_in_document_head() {
    global $post;
    $author_id=$post->post_author;
    ?>
    <link rel="author" href="<?echo get_user_meta($author_id, 'u-profs2', true);?>"/>
    <?
    }
    add_action('wp_head', 'google_rel_author_in_document_head',99);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Morning, I am having an issue adding up some totals using jQuery. I am
I am having an issue adding posts to LiveJournal via the xmlrpc api they
So I'm having an issue with adding to an ArrayList or a Linked List
I am creating a personnel recruitment website and am having an issue with adding
i'm having this issue, in ASP.NET MVC 2 where I'm adding a drop down
I am having an issue with adding dynamic content through an interval. The content
I'm having this issue where doxygen is adding the method twice in the documentation
I am having an issue with creating and adding sales/quote_address objects to the multishipping
I am having an issue with a site in that it seems like my
We are using MSDTC for SQL transactions. I am having issue with setting up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.