You need to use wp_update_user function to update user info. Please see below code:
<?php
$user_id = 1; /* It would be dynamic in your case */
$display_name = $_POST['display_name'];
$user_id = wp_update_user( array( 'ID' => $user_id, 'display_name' => $display_name ) );
if ( is_wp_error( $user_id ) ) {
// There was an error, probably that user doesn't exist.
} else {
// Success!
}
?>
Related Posts:
- What is the difference between an ORM and an ODM?
- Rename a table in MySQL
- How should I tackle –secure-file-priv in MySQL?
- Checking if Database Table exists
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- Is it possible to define two databases for one installation?
- Connect forms in WP to external database
- Hook into $wpdb
- Syncing local content with development / staging sites
- Export WP database for import using WP-CLI on Vagrant Box
- Is it wise to delete post revisions and autosaves from database?
- Improve or optimize a very slow query
- What is the advantage of separating wp_users and wp_usermeta table?
- “MySQL server has gone away” since update to 3.8
- WordPress page title repeated in SOME pages
- Using two different DB users on one WP install
- Usage of Direct Database Call Without Caching Error
- How to correctly add a table to the WordPress MySQL database
- Can I transfer a mysql database to another site?
- MySQL Syntax Error upon restoring database from backup [closed]
- Help running a MySQL query to update all wp_#_options tables in a Multisite install
- Merge two databases: OLD SITE -> NEW SITE
- Is it safe to convert tables from MyISAM to InnoDB?
- Backup another database with BackUpWordPress plugin [closed]
- Easiest Way to Authenticate WP Users Using an External DB?
- Use one WordPress database with multiple instances of one site
- Who is responsible for data sanitization in WordPress development?
- How do I properly update the WordPress database password?
- How to check if a core update, like 4.9.8 → 5.0, involves a database update (migration)?
- $wpdb->insert is not working
- How do I find out the full path of a page’s template?
- I need to get an array from the wordpress database
- Moving minor updates between local and live sites – just database?
- what is the best way to store user created data?
- Using GROUP CONCAT in my-sql query with wp_usermeta table
- “The link you followed has expired” & “Error while saving” messages when adding new post
- input data and output table [closed]
- How to move the WordPress site Layout from test site to Production site?
- Sending data with multi step form to wp database
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Retrieve data from the database to table such as comments in the admin control panel
- Need to store custom user information (many-many relationsips), preferably not as user meta
- charset problem with new custom table
- WordPress and user security
- How to share plugin created database tables between two WordPress sites
- How to connect to a remote database in WordPress?
- Migrating from PDO using SQLite to clean new install using MySQL
- Change WordPress URL in sql file via Terminal
- $wpdb->insert Giving duplicates
- Where is phpMyAdmin inside WordPress?
- What can I do when an outside party hacks into my weblog and changes my display name?
- How to properly check if a table exists in WordPress Database using Show Tables Query
- How to delete database without using any plugin?
- Cannot restore wordpress database from sql dump [closed]
- WooCommerce: remove sample & dummy data
- Is database deleted on clicking “reinstall” button in WordPress updates?
- Fill custom select field with pages/post titles
- Is my way to change WordPress server is correct?
- Recovering the table wp_usermeta from users
- WordPress database products structure
- I cannot find the difference between these wp_capabilities values in wp_usermeta
- Files on Localhost, Database on Server
- Is there any way to monitor a MySQL db and check what has changed?
- DB prefix not updating
- Replacing javascript link in WordPress database without getting mysql syntax errors
- Any other way of storing plugin admin data setting
- Will memcached improve performance with WP Super Cache already running?
- What structure and database storage method should I use for temporary storage that may be written concurrently?
- how to access 2nd Mysqli Database from different server for wordpress
- Error establishing a database connection – WordPress setup, everything else is working
- Restore of database doesn’t show content
- Why theme settings lost when I installed https
- WordPress site migration – locked out of admin area
- WordPress users table missing indexes
- unable to use my wordpress site after moving
- How to add download link from database on custom page template?
- WordPress URL error for links
- Search and Replace in Windows XAMPP site
- How to get the id of recently registered user from database?
- How can i syn wordpress user table with a stand-alone php script?
- insert data from a form:: Warning Empty query mysqli::query()
- Cloned site not connecting to database – MAMP
- How can we speed up wp_get_nav_menu_items()?
- Generating an HTML table from an array based on dynamic key values
- Mysql Queries per Visit – Crazy High
- Media Library doesn’t allow uploads? Upload Directory
- Split posts between databases
- Moving Site: Is Re-downloading Files After Changing URLs necessary?
- using same mysql user with many databases
- Manage 3 Layers Of Information (CTP – Posts – Then Maybe Metadata?)
- Get id from database
- Pulling values from a sepcific row in table
- import (migration) user database to wp-users
- Create hundreds of users with just ID in phpMyAdmin
- What is best for saving lot of extra detail of user?
- Insert Extra fields added in the front end registration form to DB
- $wpdb->insert not working for last select option
- How to create a table [closed]
- Upload wordpress from localhost to 000webhost
- How to properly configure SSL connection to remote azure database for running queries within a WordPress environment