php - Adding Extra Fields to the WordPress User Profile -


i have strange problem. have added custom field user profile , used the_author_meta() function display fields content. yeasterday works great. today doesn't work.

custom field in user profile. when click update profile - content of fields remains in place (so information should saved). on authors page have <?php the_author_meta( 'skills' ); ?> happens nothing.

i followed tutorial when creating own custom field: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

and 1 when tried find error in code: http://bavotasan.com/2009/adding-extra-fields-to-the-wordpress-user-profile/

they both similar. worked page templates since yesterday, maybe caused problem. deleted i've added since yesterday. nothing changed.

here code:

// custom field in user admin - save add_action( 'personal_options_update', 'my_save_extra_profile_fields' ); add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );   function my_show_extra_profile_fields( $user ) { ?>      <h3>skills - färdigheter</h3>      <table class="form-table">          <tr>             <th><label for="skills">skills</label></th>              <td>       <textarea type="text" name="skills" rows="4" cols="50" id="skills" class="regular-text"><?php echo esc_attr( get_the_author_meta( 'skills', $user->id ) ); ?></textarea><br>                       <span class="description">please enter skills.</span>             </td>         </tr>      </table> <?php }    // custom field in user admin add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );  function my_save_extra_profile_fields( $user_id ) {      if ( !current_user_can( 'edit_user', $user_id ) )         {return false;}      /* copy , paste line additional fields. make sure change 'twitter' field id. */     update_user_meta( $user_id, 'skills', $_post['skills'] ); } 

now think save user meta successfully. need display them.

now can use function "get_user_meta($user_id, $key, $single);". visit here: https://codex.wordpress.org/function_reference/get_user_meta thanks


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -