By default, WordPress uses $wp_object_cache
which is an instance of WP_Object_Cache
to save on trips to the database.
Trace back username_exists()
function, you will notice that get_user_by()
uses WP_User::get_data_by()
which return user data from $wp_object_cache
immediately without checking if that user exists in database. Note that $wp_object_cache
is stored in memory.
It means that if you deleted an user record directly in your database without cleaning up user cache, user data is still available. That’s the problem.
So what you’re missing?
-
Missing to delete user the right way.
-
Missing to clean user cache.
Related Posts:
- Automatically delete inactive users after 2 months
- Delete all subscribers from wp_users and wp_usermeta a few thousand at a time
- How can I add a user through SQL?
- importing users where password is provided as md5 + much metadata
- Search multiple meta keys at once
- Return ID of authors who have at least one post
- wp_insert_user is not working for me?
- Add user data to table when user is created?
- Bulk create clean user_nicename from user_email with SQL function
- C# user_nicename and Display name blank
- How do I transfer user passwords from one WordPress site to another?
- I am getting mysql_real_escape_string() function error while adding user?
- MySQL query to mass change role of users
- WordPress SQL Issue not returning correct reselts
- create new users in db starting at what ID?
- Delete Users without a First and Last Name
- Delete all users with Editor role and their content mysql
- How do I change the user via SQL?
- is_user_logged_in() not working after domain change
- MySQL query to list users who never signed in
- How to allow an user role to create a new user under a role which lower than his level only?
- How to get userid at wp_logout action hook?
- What’s the difference between the capability remove_users and delete_users?
- How to change user_login with wp-cli?
- How to hide media uploads by other users in the Media menu?
- Get users with atleast one post
- edit profile validation refreshes all field if missing wordpress
- Track logged in users’ visits
- order users with drag’n’drop?
- include user profiles in search results?
- Plugin that would allow WordPress Authors to “follow” other Authors and query “Activity Info” from that
- How to delete users with no order history through phpmyadmin sql?
- User profile custom field
- Authors Page : A page of authors
- Limit content by user registration date
- What is the best way to avoid spammers registering to my blog?
- Completely hide user info
- Gravity Forms Submit form as another user
- Redirect User to Homepage if no other redirect is specified
- Set default page for user account in admin
- Searchable meta value in user.php
- Find out who created a certain user?
- Locate authors on Google map version 3
- Add email addresses to already registered users
- show text If special user is logged
- Multiple Backend Users as single Frontend User
- Forcing WordPress to work differently
- Does WordPress Importer notify imported Users?
- Remove user profile field [duplicate]
- Can user login details be used for other applications?
- How can I attach a user to another user with user meta
- How do I protect user_activation_key?
- WP not logging in at first time
- Log out users from every where
- Separate Out Real Users
- No user found when using REST API
- is_user_logged_in() throwing undefined function error
- How to prevent a specific users’s profile photo (gravatar) from showing on the frontend to other users?
- WordPress REST Api: update user
- Hackers tried user name with wrong case [closed]
- SQL Bulk update all WordPress user’s nicknames to firstname + lastname format
- Redirect logged on user to a specific page based on wp user role, page id
- Show WordPress users in grid with image and name
- Automatic Website user password generation
- Redirect users after login
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- Need to manually add multiple WP users with same e-mail address (with good reason)
- How to get current user on a multi site that is using domain mapping?
- WordPress Redirect Specific User. Tired of Peter’s redirect Plugin its not working
- Can I edit the database to change a login?
- User Meta stuff
- User can’t search himself on rest api
- How do I update user email from frontend input field?
- How to allow access based on the user meta flag
- Authentication between two different sites using the WordPress login cookie
- Cannot update newly added User field using wp_update_user
- Block editor completely gone for second of two super user
- How can I display Only the first Array/Object?
- How to create page for user?
- How to prevent multiple user accounts with the same meta field?
- How do I set a maximum upload size for a specific user role (Editor)
- Return all users that have one or more published blog posts
- members only products
- Modify the user data stdObject and add extra items to it?
- Create relationships between users or user roles
- User Permissions on custom post type
- update custom field user profile from front end form
- Change “logged in as a ” link in comments form
- Specific Content on pages based on user
- Custom user query – orderby meta_key (that may not exist)
- I try to add informations to User profile
- force registered user as seller
- Not able to call value in the core files
- Privacy in WordPress
- Create a wordpress admin user and only let them edit and post blog posts?
- How to display Most Recently Read 10 Posts by a logged in user in wordpress
- Email Subscribe for Downloads in WordPress
- Cant edit profile from frontend
- application password is missing