You’re not handling the names the same way as the other fields:
//// VERIFIES CREDENTIALS
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$first_name = isset($fields['user_first_name']) ? sanitize_text_field(trim($fields['user_first_name'])) : '';
$last_name = isset($fields['user_last_name']) ? sanitize_text_field(trim($fields['user_last_name'])) : '';
$email = isset($_POST['email']) ? trim($_POST['email']) : '';
Notice how you use $_POST['email']
and $_POST['username']
, but then you use $fields['user_last_name']
, but there is no $fields
variable in your code
As a sidenote, I would not use variable names such as $return
, etc, they’re reserved PHP keywords and using them for variable names is suboptimal and bad practice
Related Posts:
- username_exists() function can’t be access without logging in
- How build a custom login/register form with error handling?
- Can i check if user is doing any ajax request?
- How to add default images into theme customizer image control?
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Validate a users email address when using gmail to register
- Click loads template via ajax
- How to speed up admin-ajax.php in wordpress
- get post based on category chosen in drop down – The ajax method
- How to store data from multiple forms using ajax and php
- PHP 8, AJAX mail form to function.php doesn’t work
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Why ajax doesn’t work on certain wordpress hooks?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- dynamic dependent select dropdown
- how to make custom ajax handler?
- How to disable controls in theme customizer?
- Run a code only on theme activation only during first activation
- is_user_logged_in() not working in AJAX validation call
- Using data sent via AJAX in multiple functions on a WP plugin
- Function won’t run onclick using Ajax
- Fatal error: Call to undefined function register_new_user()
- Simple AJAX notification when the new post is added to the database
- Why i can’t get custom fields value or post ID via Ajax?
- Post not populating for custom post type based on category selection
- How to get post category list as select in front-end?
- Is there a hack for using is_page() within the function.php file?
- Execute Jquery when a specific page in my plugin is loading
- AJAX function not working [closed]
- Disclaimer that will show every refresh of the page
- Database entry removed on browser refresh, Ajax PHP jQuery
- Store ajax data in PHP variable
- Multiple AJAX handler functions conflict in functions.php
- Ajax filter with loadmore button
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- register_block_type is not working properly
- get_the_author_meta( ‘ID’ ) just return 1
- Update $wpdb query with AJAX
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- Including user data in “new user notification email”
- WordPress Ajax filter: Create two loops for different output styles?
- How to auto-generate random numbers in username?
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- Offset with ajax load more posts duplicates
- ajaxurl usage for a custom function
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- Find the method which AJAX GET calls
- AJAX Returning Way Too Many Posts
- wordpress ajax return 0
- wp_delete_comment is doing nothing
- Modify category archive page loop on functions.php
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- ajax form function error
- AJAX: WordPress filters inside $html do not work as intended
- How to set and use global variables? Or why not to use them at all
- problem with ajax and the path to the php page
- Enqueue Javascript Correctly for 3.5
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Add footer.php to WordPress child theme
- Targeting single page with JS
- WooCommerce – Display variation custom field value [closed]
- Restrict WordPress File Type Uploads by User Type
- Use template for posts with a particular category grandparent
- How to slow down server response
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Use menu link or onClick to set a variable
- Automatically remove a canceled order in Woocommerce
- How to remove the cufon script from Dzonia Lite theme [closed]
- Change “add to cart” button color based on Woocommerce product category [closed]
- Ajax request returns ‘Array’. How to output the actual results?
- Create highly customized submenu (possibly using wp_list_pages)
- $wpdb->wp_users returning empty value for
- WordPress Custom field Colors
- Sending a custom form data in email through WP Mail Function
- How to use array in function to get only value I want
- How to add PHP code in functions.php wordpress
- add_filter function concatenate string and locate_template function
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Custom User Registration script only allowing usernames with 16 characters
- PHP: How to access db the right way in plugin?
- how to changes mobile menu toggle breakpoint in WordPress
- Get page permalink in contact form
- How to display already created menus via php?
- Grabbing Image name From Product Image Gallery
- remove_action from parent theme using child theme functions.php
- Cant get blog name with get_option
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- Extra editor on top of default in Custom Post Type
- Pagination 404 error(I have refreshed the permalinks and tried several previous options)
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Help hooking into user_register
- Input field duplicates on form submit by jQuery
- Ajax wordpress function showing source code in alert and not value of input field?
- site_url() returns with additional backslashes
- Adding instant search to wordpress page
- Overwriting a Shortcode
- Warning: Attempt to read property “term_id” on int – Woocommerce
- AJAX WP_Query’s order and orderby parameters not working
- How can I use AJAX in child theme template?