In the function that you’re hooking into user_register
, you need to create the user and save the values. First, I’d recommend using wp_insert_user()
instead of wp_create_user()
.
You might do something like this:
$userdata = array(
'user_email' => $email_address,
'user_login' => $user_name,
// this is automatically salted
'user_pass' => 'plain_text_password',
);
// this function returns the user id
$user_id = wp_insert_user( $userdata ) ;
$data = array(
'field_key_name' => $data_one,
'field_key_name_two' => $data_two,
);
foreach( $data as $k => $v ) {
update_user_meta( $user_id, $k, $v );
}
// if wp_insert_user fails, it returns an error object
if ( is_wp_error( $user_id ) ) {
// error
} else {
// success
}
If you are saving the data to a custom table, you would perform that update query in place of update_user_meta()
, which saves your data to the wp_usermeta
table.
Related Posts:
- Custom Widget not Available after Plugin Installation
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Plugin upgrading: Widget settings
- How to have WordPress send a user confirmation/validation email on signup
- How can i force Display names to be the same as Usernames?
- Need to create a Theme demo site that features multiple themes
- Override dynamic_sidebar() in plugin?
- Is dynamic forms/entries possible in Widget?
- How can a Firebase user registration and login be integrated into a WordPress site?
- How to place random widgets in the WordPress sidebar?
- Pages with 2 Columns
- How to create custom LOGIN and REGISTRATION forms?
- Custom Widget Creating PHP Exception When Placed In Its Own PHP File
- Registration Form Validation in wordpress
- register child class in another plugin
- Conditional Display of Links in Widgets
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- Will WordPress username displayed somewhere in the site?
- WordPress multiple widget in single plugin
- Created Widget Not Showing up on Admin Panel
- How to display public user profile with 2 additional fields? (GitHub source code included)
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Upload files programmatically to users
- Flickr plugin that will display photos from multiple group pools? [closed]
- action-scheduler vs wp-background-processing
- WordPress author details plugin/widget
- Average Account Age
- WAMP to XAMPP WordPress transfer
- The plugin generated 3 characters of unexpected output during activation
- Theme’s default styles are overriding my plugin’s custom CSS
- Add a captcha form to the woocommerce register form
- Rotate Widgets or Content Blocks every x sec/min
- Multi language site [closed]
- How to style the RSS wordpress?
- How can I disable widget from being visible on some pages?
- How to display more than one instance for a widget?
- Custom random quote widget breaks when used in multiple sidebars
- Hooking in to replace the Sidebar/Widget areas
- Do widget options need to be escaped widget()?
- Ajax contact form widget plugin data not insert in database
- How to hide CSS by default and show on button press
- Widgets Scripts don’t load – but load when I reload the page
- How to add wp visual editor in a custom widget?
- WordPress Widget – Saving multidimensional arrays into $instance
- Custom plugin appears outside of the sidebar container
- Char limit on custom blog-post form? [closed]
- How do I use wp_editor() in widget form?
- How to reorder and display a feed to be chronological?
- Hide certain widgets from specific user roles in admin
- How to add Wrapper Div/container element around WordPress Widget Content
- How do I find out what is in control over a certain part of a website?
- easy steps to make front end form without plugin
- Best practice for including plugin output in a template without using shortcode?
- Custom widget doesn’t save values from dropdown box
- Register Script in Plugin Widget
- Add Shortcode tag in Widget/Sidebar
- How to create wordpress widget that is fixed position on the home page
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Short messages widget [closed]
- jQuery Click event is not fired at all
- Widget for specific category
- get_term_meta returns false in widget
- How can I apply no-disposable when programmatically adding a user with wp_insert_user()?
- My widget won’t update its values when save is clicked
- Widget where it can make changes to the container
- Extend a plugin to include a widget option
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- Modify pages widget and make a plugin?
- How to automatically activate users after registration without activation email?
- Table of contents (TOC) plugin is not showing header tag
- How can I display selected content from a seperate database in an Activity style widget?
- How to fetch WordPress database values in JavaScript widget
- RSS Feed on WordPress showing code (hypertext) in articles titles
- How to add Mobile field in Registration form using Theme my login Plugin
- What is the right way to populate a dropdown from MySql?
- Shortcode generated widget to appear on same line as heading text and button
- How do I keep children of certain parent menus expanded by default on a sidebar?
- User / membership Plugin [closed]
- Widget logic using woocommerce product category
- How to display widget in front end?
- Widget outputs the value but doesn’t save anything inside the textarea
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Using Widget Logic to place menu on multiple pages?
- Overwrite user role
- Show widget location borders for development
- Cannot access variables within a widget
- How set role at registration based on email?
- adding image in the header of my dev widget
- Plugin: Unable to Save the Image Alignment Option to Display in the Widget in the Sidebar
- Template from scratch: Sidebars not showing widget
- What plugin(s) are best for this User registration task? [closed]
- How to develop an extension for a simple form post and post back? [closed]
- How to add homepage Widget?
- What are the downsides of using bootstrap in plugin development?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Am having issues intergrating this api into my wordpress site, any help please?
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Use custom Javascript for a custom Elementor Widget [closed]