User Fields Generator

Home » WordPress Generators » User Fields Generator

Related core generators wp-config.php generator Cron job generator Hook generator Go back to all generators

The name of the function that will be created.
The name of the save function that will be created.
The headline of the user field group.
The text domain of the plugin.
The type of field.
The label for this field.
The HTML ID for this field.
The placeholder text for this field.
The description for this field.
                    // 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' );


Sign up to save your WordPress snippets on WPTurbo.