Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active November 25, 2020 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/323aa58ed52102e896fcaafae79d4579 to your computer and use it in GitHub Desktop.
Save plugin-republic/323aa58ed52102e896fcaafae79d4579 to your computer and use it in GitHub Desktop.
<?php
/**
* Add custom field to registration form
*/
function my_prefix_registration_fields( $fields ) {
// Add a text field
$fields['new_field'] = array(
'label' => __( 'New Field', 'wcmo' ),
'type' => 'text',
'priority' => 250,
'add_to_profile' => true // Select this if you wish to display this field in user profiles
);
// Add a select field
$fields['new_select_field'] = array(
'label' => __( 'New Select Field', 'wcmo' ),
'type' => 'select',
'priority' => 300,
'options' => array(
'option-1' => 'Option 1',
'option-2' => 'Option 2'
),
'add_to_profile' => true // Select this if you wish to display this field in user profiles
);
return $fields;
}
add_filter( 'wcmo_registration_fields', 'my_prefix_registration_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment