Custom field value not returned by get_the_author_meta()
-
Hi I want to add a custom field to users profile to store a value to be used in a database query.
The code I have come up with is:function my_save_extra_profile_fields( $user_ID) {
if ( !current_user_can( ‘edit_user’, $user_ID ) )
return false;update_usermeta( $user_ID, ‘gnasnumber’, $_POST[‘gnasnumber’] );
}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=”gnasnumber”>GNAS Number</label></th><td>
<input type=”text” name=”gnasnumber” id=”gnasnumber” value=”<?php echo esc_attr( get_the_author_meta(‘gnasnumber’,$user->ID) ); ?>” class=”regular-text” />
<span class=”description”>Please enter your GNAS Number.</span></td>
</tr>
</table>
<?php
}The code works and creates a value in the wp_usermeta table for the field but I cannot retrieve the value using get_the_auther_meta(). It works for all the other fields in the profile but not the custom field.
Can anyone help me figure out what is going wrong here?
- The topic ‘Custom field value not returned by get_the_author_meta()’ is closed to new replies.