function.php에 아래 내용 추가
function userMetaCustomForm(WP_User $user) {
?>
<h2>Custom</h2>
<table class="form-table">
<tr>
<th><label for="user_Custom">Custom</label></th>
<td>
<input
type="text"
value="<?php echo esc_attr(get_user_meta($user->ID, 'custom', true)); ?>"
name="user_custom"
id="user_custom"
>
<span class="description">Some description to the input</span>
</td>
</tr>
</table>
<?php
}
add_action('show_user_profile', 'userMetaCustomForm'); // editing your own profile
add_action('edit_user_profile', 'userMetaCustomForm'); // editing another user
add_action('user_new_form', 'userMetaCustomForm'); // creating a new user
function userMetaCustomSave($userId) {
if (!current_user_can('edit_user', $userId)) {
return;
}
update_user_meta($userId, 'custom', $_REQUEST['user_custom']);
}
add_action('personal_options_update', 'userMetaCustomSave');
add_action('edit_user_profile_update', 'userMetaCustomSave');
add_action('user_register', 'userMetaCustomSave');