// Add custom fields to the user profile edit page.
function wpturbo_my_custom_user_fields( $user ) {
$html = '';
$html .= '<h3>' . __('My Custom User Fields', 'wpturbo') . '</h3>';
$html .= '<table class="form-table">';
$html .= '</table>';
echo $html;
}
add_action( 'show_user_profile', 'wpturbo_my_custom_user_fields' );
add_action( 'edit_user_profile', 'wpturbo_my_custom_user_fields' );
function wpturbo_my_custom_user_fields_save ($user_id) {
if ( !current_user_can('edit_user', $user_id) ) {
return false;
}
}
add_action( 'personal_options_update', 'wpturbo_my_custom_user_fields_save' );
add_action( 'edit_user_profile_update', 'wpturbo_my_custom_user_fields_save' );
User Fields Generator
Related core generators wp-config.php generator Cron job generator Hook generator Go back to all generators