It’s a three step process.
-
First, get a list of Editors using
WP_User_Query
. -
Get a list of each user’s posts using
get_posts
and delete them usingwp_delete_post
. -
Lastly, delete the user itself using
wp_delete_user
.
Related Posts:
- Automatically delete inactive users after 2 months
- Delete all subscribers from wp_users and wp_usermeta a few thousand at a time
- ‘username_exists’ still returns an ID even after deleting record from the database?
- 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
- How to delete users with no order history through phpmyadmin sql?
- wp_insert_user is not working for me?
- Set Display Name to first and last name (phpmyadmin SQL Query)
- 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
- 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
- Forbidden :You don’t have permission to access /phpmyadmin on this server
- Fix Access denied for user ‘root’@’localhost’ for phpMyAdmin
- #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
- MySQL said: Documentation #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
- Confirmation required on email change
- Email user when password is reset by admin
- How to work around “that email address has already been used” error?
- How can I run a WP-CLI command as authenticated user?
- LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?
- Upload gravatar in WP profile?
- Recover the user that have been deleted
- Check if user is online?
- How to check that if current user (ID) has posts or not
- How to track a users progress through pages by inserting data into WordPress Database?
- How to get the Role Name of the current user? (WordPress)
- how to get recent registered author id?
- Is it possible to duplicate users on a new WordPress install?
- Why don’t first_name and last_name appear when you print_r the WP_User object?
- How to use search_columns in WP_User_Query?
- How to delete posts that does not have a thumbnail?
- Authenticate with a Rails app?
- Send Email to Users after Deleting Account
- How to add local users to wordpress without email password?
- WP User Query fails when searching meta queries and search columns
- Call to undefined function wp_insert_user()
- Update slug (URL) of pending posts via phpMyAdmin
- *wpupdateuser* user_login in my WordPress database
- Updating user meta
- Changing a username
- Change the user_login at registration
- How to add a user profile page to frontend?
- Error: How to allow the “contributor” to upload media in wordpress
- Delete users from multisite after they have not logged in for a set amount of time?
- Where is the information about the authors for articles stored?
- User management system similar to wordpress one?
- Restrict access of admin uploads to certain logged-in users?
- how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard
- Find user by nicename and open profile
- Custom default filtering in the user admin panel disables the other sortable columns
- Creating user without username and password
- Is this code true or not
- Check for valid email after user inactivity?
- Better ads plugin has 500.000 entries in wp_postmeta
- How do I let contributors edit their posts after being approved once?
- Custom Comment Notifications Fire on each Page Load
- The Simple and Correct Way to Add User Meta
- how to set default update_user_meta values wordpress
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- Redirect user to login if not logged in, on specific pages
- Need to change all links in page content but not in post content
- Check if user is logged in via JS? [duplicate]
- Files on Localhost, Database on Server
- Page for logged in user to Edit/Delete their own content?
- Using mysql to replace img src?
- Followers for WordPress [duplicate]
- Is it possible to build social networking website using WordPress?
- DB prefix not updating
- Is there a way to call via javascript if a user is logged-in on a static html file?
- Restricting wordpress login sessions for a web app
- change user password REST API
- Use WP cookie to authentificate user on an external app
- Find count of WordPress users by role and search string for user name
- Append USER ID to an outbound link?
- SQL query to change custom field in WordPress database
- Users activity history
- How to destroy all user sessions via WP-CLI
- Is a list of user names or IDs in a custom profile field the best way to create a followers list?
- Get the author registration date in the header.php file
- Front end login and page restriction
- Designing a member area on my site
- Link to Authors blog posts
- view and update form only for registered users
- Redirect based on log-in status per JavaScript
- i need to let a user to add a role from a frontend form
- Integrating Facebook Registration (and Login) on a WordPress page
- Create users from frontend without password
- How to get user contact info
- Why does a super admin on multi site get a rest_user_invalid_id error code when requesting user details through REST?