It was actually much easier than I originally thought – just doing a WP_User_Query
for a meta value (meta arrays are supported as well, like for the other query classes).
public function on_deactivate()
{
$meta_key = 'tools_page_tsi_per_page';
$query = new WP_User_Query( array( 'meta_key' => $meta_key ) );
if ( empty( $query->results ) )
return;
foreach ( wp_list_pluck( $query->results, 'ID' ) as $user_id )
delete_user_meta( $user_id, $meta_key );
}
Related Posts:
- Four columns in the wp_users table
- How to use 2 different databases but share the same user in wordpress
- How To Add Custom Form Fields To The User Profile Page?
- Why are my roles not visible in a Multi-site/Network?
- How to use same email for multiple users
- Where can I find documentation on what characters are allowed in user names and why?
- Is there a is_user_logged_in() for multisite?
- WordPress Multisite allow site admin to add user without email confirmation
- wordpress multisite, how to keep user on subdomain throughout registration process?
- get_user_meta() to Return User Meta Only for Current Blog in Multi Site
- Network not displaying all sites and users
- WordPress Multisite – When a user signs-up on main site, how to add the user to a subsite
- How to use alias domain for multisite installation?
- Give to site admin the option to “skip confirmation email” when adding new user
- Different back-end colour scheme for the different sites of a multisite
- Set up collaborative site
- Getting all user metadata from user
- Wp_User_Query not sorting by meta key
- WP_User_Query with combined meta query – not working?
- How does WordPress connect sites and the wp_users table?
- Prevent user creating new users with specific roles
- Allowing logged in users to comment without moderation across a multisite installation
- Can you have multi-site WP and keep users separate?
- SQL to check how many sites a user is a member of
- How to add multiple existing users to a multisite site?
- Delete options from all blogs on plugin uninstall from a network/multisite
- the blog owner multisite
- Exclude main blog from get_blogs_of_user
- How can I get multisite primary blog (url or path) for current user?
- Get users primary blog URL in MultiSite
- Why can’t I delete original user in multisite? Options for manual removal
- Can I use multisite functions in a single-site installation?
- How to add edit users capability to a custom role?
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- In MultiSite, can some users automatically have Site Admin rights on all sites, without granting them Network Admin access?
- Downgrading a WP3.3.1 Network Install
- How can I delete a user from entire multisite nework
- delete_user_meta : how to delete all the metadata of a given user (witout SQL)
- How to search users globally on a multisite install?
- WP User Query fails when searching meta queries and search columns
- Update User Role Across Network when Main Site User is Updated
- Assign role to user on first login, if they are first (after admin)
- Get the User ID Who Owns a Given Blog ID in Multisite
- Make a user administrator to a sub directory site and a contributor to main site in multisite network
- How to store custom user data on the database?
- Displaying a message upon user registration
- How is a user’s primary blog determined?
- How to change user starting role in WordPress MultiSite?
- Multisite – One user allowed access to all sites?
- Add a user to a specific blog when they register?
- WP_User_Query pulling ACF to loop
- How do you disable account activation in WPMU and then log the user in right away?
- Good way to block users within a multisite setup without deleting them?
- Subsite access without being a member of the subsite in wp multisite network
- Passing args to WP_User_Query am I using meta correctly?
- Create Custom Multisite User Role to Reduce Capabilities
- Obtaining user table for one site on multisite set up
- WordPress stuck in deleting user
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Get users registered 30 days ago(or more)
- Bulk Move Users from one site to another within a network ( Multisite )
- WordPress Multisite – Load users using custom query
- Randomize Users
- User Role is Not Specifying in WordPress Multisite?
- Copy user role on multisite so the user can access subsites with same role
- How To Disable Add new users On Subsites In Multisite?
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Solving a get_user_meta() problem in Multisite
- Display the line breaks in user bio without using html
- get_user_meta() in multiste with respect to subdomain
- Delete all user’s meta without knowing all the ‘key’
- Wait ajax to complete before continue loop
- Delete user from multisite when removed from subsite
- Combining user database tables while keeping all other data in seperate for multiple sites?
- How to fix that new users show up again in subsite of a Multisite?
- How to delete user from MU site when the user is removed from their site?
- WordPress Multisite Add User
- Sharing users across multiple sites, each on their own database
- Customize or avoid new admin email address notification
- How to share User Database between Two Multisite Installations + More
- WPMU add custom colum
- Using Same User Database on Subdomain
- How to get the blogs owned by a user?
- WP_User_Query not searching
- How to redirect user after session timeout
- can’t create user without email for an author after converting single site to multisite
- Restrict users of site 1 to login in site 2 in wordpress multisite
- “My Sites” incorrectly showing all network sites for all logged in users
- How to use the same users table on multiple wordpress sites
- Easily adding multiple existing users to a multisite site
- Getting user data via ajax
- Possible to have duplicate usernames on different two multisites
- Multisite – each site with it’s own set of users
- Modify new user email notification in network admin screen wp multisite
- Users getting linked unwanted to main mu in WordPress multisite (WPMU)
- Multisite – site user limited only for this site
- Can’t activate a user on multisite install
- Importing Posts into New Website with Same User ID’s
- WordPress automatic Login on other page?
- A different role for each site in a multisite