Skip to main content
added a note
Source Link
stoi2m1
  • 431
  • 3
  • 10

NOTE: This answer looks irrelevant to the OP's question after further analysis of the added/updated function in the question. Im leaving this answer in place and creating a new answer for historical use, since part of the question seems applicable.

You could use something like the following to create user meta when users are added to the user table. Put this in the functions.php file of your theme.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

You could use something like the following to create user meta when users are added to the user table. Put this in the functions.php file of your theme.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

NOTE: This answer looks irrelevant to the OP's question after further analysis of the added/updated function in the question. Im leaving this answer in place and creating a new answer for historical use, since part of the question seems applicable.

You could use something like the following to create user meta when users are added to the user table. Put this in the functions.php file of your theme.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

added info on where to put the function
Source Link
stoi2m1
  • 431
  • 3
  • 10

You could use something like the following to create user meta when users are added to the user table. Put this in the functions.php file of your theme.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

You could use something like the following to create user meta when users are added to the user table.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

You could use something like the following to create user meta when users are added to the user table. Put this in the functions.php file of your theme.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

previous answer was too brief
Source Link
stoi2m1
  • 431
  • 3
  • 10

UseYou could use something like the user_register hookfollowing to create user meta when users are added to the user table.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on WP Codex - user_registeruser_register hook More info on update_user_meta() More info on get_user_meta()

Use the user_register hook WP Codex - user_register

You could use something like the following to create user meta when users are added to the user table.

function myplugin_registration_save( $user_id ) { if ( isset( $_POST['first_name'] ) ) update_user_meta( $user_id, 'your_key', // name of key $your_value // value of your key ); } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); 

To retrieve this data for later use use the function:

get_user_meta($user_id, 'your_key', $single); 

More info on user_register hook More info on update_user_meta() More info on get_user_meta()

Source Link
stoi2m1
  • 431
  • 3
  • 10
Loading