Direct modification of WP database is a very bad idea. In your case, you have problem because you avoid caching. WordPress caches almost everything what is able to cache, and user data are not the exclusion. When you call username_exists()
, it returns information from the cache, not from the database.
You should use wp_update_user()
to update user data. It sends emails to users, however, on changing password and email. You can suppress this behaviour by filters send_password_change_email
and send_email_change_email
(just rturn false from your callback function).
The worse way is to flush user caches after modification of database fields. You can do it by calling clean_user_cache( $user )
.
Related Posts:
- If the current user is an administrator or editor
- How do I add a field on the Users profile? For example, country, age etc
- WordPress usermeta scaling for thousands of users
- Groups of capabilities: users with multiple roles?
- Is there a way to merge two users?
- How to restrict access to uploaded files?
- Execute a function when admin changes the user role
- Best way to send users password?
- Importing users? From another wordpress site
- How to discover and delete unused accounts?
- Multi-steps WordPress registration : in 4 steps how to?
- Allow guests to save favourite pages?
- Basic auth WordPress REST API dilemma
- Remove all users from site except one using WP CLI
- security+best practices: root or www-data on a wordpress content folder?
- Show Biographical Info while creating new user
- How to enable the theme editor cap for an editor role?
- WordPress keeps asking for connection information in localhost
- importing users where password is provided as md5 + much metadata
- How do I properly format the user_role array?
- How can I secure a WordPress blog using OpenID from a single provider?
- How to edit user_id on the comment edit screen
- Redirect after login based on user role (custom login page)
- get_users() ORDER BY Not Working
- Can I create users that have access to *some* other users posts instead of all other users posts?
- My custom page template with is_user_logged_in() does not detect that I’m logged in
- Total Word Count For Posts And Comments By One Author
- Delete user from frontend
- Share user table from WP with Drupal
- How can I display show/hide elements when user is registered?
- How can I allow password reset based on logins containing the @ character?
- Register new user in the frontend
- Force logout ALL users at a certain time
- Show MD5 Password in user section
- User Last Login Sort Column
- get_users() timeout on big userbase — options to divide query?
- Plugin for limiting user registration based on ip with expiry period?
- Get tags for current user
- Using user_status in conditional with get_users to return existing users
- Split Blog Into Two Sections?
- how to update or refresh the wp user object?
- mysql query two database tables, users and usermeta and sort by custom meta int value
- Including users in insert link internal link search in Gutenberg
- Add value in user table when user is created
- How to hide WordPress users’ names externally?
- Force user to change their password on the frontend at the first login and password policy
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- How to force authors to ‘submit for review’?
- Turn off password requirement
- How to duplicate a wordpress user and all his/her data from custom fields?
- How do I transfer user passwords from one WordPress site to another?
- How can I authenticate user credentials against a WordPress instance?
- Add a role and give admin priviledges
- List users by meta_key and meta_value
- MySQL query to mass change role of users
- Use WordPress Login for a non-wordpress site
- How to change user`s avatar?
- Add Custom Filter to Admin User list
- WordPress SQL Issue not returning correct reselts
- How to get last user with wpdb?
- List Users alphabetically with heading
- How to default/force the user’s display_name to their nickname?
- Restrict access to non-wordpress section of site with user roles?
- how to remove email field from default user registration form on wordpress
- Add custom user meta data
- Does it matter if the very first user, usually Admin, does not have a user ID of 1?
- How to set default’ => $current_user->user_login
- Groups and subgroups for permission
- How to add an attribute to a user?
- Can i use two different user tables for on WP install?
- Making WordPress available while logged into another website
- Get user ID when action row link is clicked
- Advanced Custom Fields Plugin: how would I get an image src path uploaded from User Profile?
- Whenever I got to my new pages (http://www.cwmags.com/news) it requests login?
- User with same Mail but a different additional info(like domain)
- current_user_can() causing critical error
- How to connect wordpress user with my own APP user?
- Author Error “Sorry, you are not allowed to access this page.”
- How to give guest users “not logged in” a role?
- Front-end uploader logging user out when they attempt to upload image
- Disabling user capability to edit_posts or delete_posts in the front-end
- Redirect /member/ to /member/user
- $user_login is not working if author has only 1 post
- WP_User object behaving strangely when used inside Admin Panel?
- How to use a transient inside WP_User_Query
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Showing extra profile fields in admin – problem with underscore
- Exclude Current user email and send notification
- Insert query not working for non-logged in user
- Disallow user registration/checkout via Hotmail/Yahoo
- Add new user and user bio at same time
- How to create a link to a user’s profile page
- Let admin users edit member profiles from front end
- Storing additional information about the user
- Current User Seeing Another Logged In User Info
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- New User Registration email
- Remove @gmail.com from WordPress username
- How to create a specific role to manage users