Skip to content

Instantly share code, notes, and snippets.

Created April 26, 2022 16:58
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hivepress/232ba63de5115a56dc21cd7f64c6e52f to your computer and use it in GitHub Desktop.
Add first and last name fields to the user registration form #hivepress #users
function ( $form ) {
$form['fields'] = array_merge(
'first_name' => [
'required' => true,
'_order' => 1,
'last_name' => [
'required' => true,
'_order' => 2,
return $form;
function( $user_id, $values ) {
if ( isset( $values['first_name'] ) ) {
update_user_meta( $user_id, 'first_name', $values['first_name'] );
if ( isset( $values['last_name'] ) ) {
update_user_meta( $user_id, 'last_name', $values['last_name'] );
Copy link

I want to add a file attachment field in the registration form, I want the user to upload his/her identity card which is mandatory at the time of registration I have applied the same method of the code given above. it works with first name and last name, but it shows an error 'id is required' even if the id file is uploaded.

registration form file required error
registration form file required error code

please help me with this

Copy link

Please try using our community forum for requests like this one, if there's no simple code snippet we can provide some guidance if you're familiar with WordPress development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment