Add this code in functions.php. visit your site you, it will automatic add/update all user meta value. After executing this code just comment out or remove this code.
$args = array(
'fields' => 'all',
);
$blogusers = get_users( $args);
foreach($blogusers as $key => $user){
update_user_meta( $user->ID, 'is_activated', 1 );
}
OR
you can also do this using $wpdb
global $wpdb;
$users = $wpdb->get_results( "SELECT ID FROM $wpdb->users" );
if( $users ) {
foreach ( $users as $user ) {
update_user_meta( $user->ID, 'is_activated', 1 );
}
}
check PHPMyAdmin you will find every user meta_key=is_activated
is set to 1.
Related Posts:
- Setting up foreign keys in phpMyAdmin?
- #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
- MySQL Error #1133 – Can’t find any matching row in the user table
- phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client
- How to create a foreign key in phpmyadmin
- importing a CSV into phpmyadmin
- MySQL said: Documentation #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
- What specific database privileges does WordPress need?
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- Updating User Meta with SQL Query
- How to copy post titles to post slug in phpmyadmin
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?
- SQL error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’ [closed]
- Can’t find my wordpress DB in phpmyadmin
- How do I join a $wpdb query with user meta using default value if not exist?
- Backing up and restoring multiple sites efficiently
- $wpdb to insert html form information
- Paypal Post IPN handeling nightmare
- Run Username SQL Query from WordPress Child Theme Functions File
- Setting up WordPress Locally on WAMP for a new site (with one already)
- Getting Error Trying to Create Table
- Copy usermeta value where ID matches in the same table
- Export Yoast Keywords from MySQL/phpMyAdmin
- Editing mysql tables/database with wordpress or other app/cms
- List users with the most posts in the last 30 days
- Export SQL query based on custom field?
- How do I echo all users’ display_name and their meta_value who have a certain meta_key?
- Mysql Server keeps crashing
- How to bulk delete a certain part of all wordpress posts
- When I add metadata, metavalue length is added in to the value in some cases
- WordPress fails to install with “Can’t Select Database” Error (WAMPServer)
- How to search usermeta table
- Find locations of all featured images of draft posts via SQL
- SQL query to change custom field in WordPress database
- An SQL query to find orphaned image attachments and their meta
- cannot log in to the mysql server (wamp and wordpress)
- SQL command to export post_content from wp_posts using phpMyAdmin
- Need SQL query to find&replace image URL
- MySQL error 2006: mysql server has gone away
- “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
- what does “/index.php?admin/admin_dashboard” in my url mean
- How to join two tables by multiple columns in SQL?
- SQL – Update multiple records in one query
- MySQL Error 1093 – Can’t specify target table for update in FROM clause
- mysqladmin: connect to server at ‘localhost’ failed
- mysql update multiple columns with same now()
- Usage of MySQL’s “IF EXISTS”
- Generating a random & unique 8 character string using MySQL
- MySQL > Table doesn’t exist. But it does (or it should)
- Getting java.sql.SQLException: Operation not allowed after ResultSet closed
- Can’t create test file lower test start server mysql
- MySQL delete multiple rows in one query conditions unique to each row
- SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
- CAST to DECIMAL in MySQL
- Failed to Connect to MySQL at localhost:3306 with user root
- Moving WordPress from MAMP to WAMP, can’t access pages
- How do you properly prepare a %LIKE% SQL statement?
- SQL query to update post_date (one post = one single date & time)
- Delete all post meta except featured image
- Database: Custom table: sprintf value for DateTime column
- Query to change custom post type with specific category
- What is the most secure way to set up the MySQL user in WPMU?
- WP_USE_EXT_MYSQL
- Select User by Joining Multiple Meta Value Results
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- Distinction on meta value on pre_get_posts
- Unknown collation when I import a dump from an existing site into a development database?
- PHP script can’t connect to Database on port 3307
- WordPress with php5-fpm and nginx
- When WordPress Default table, Echo Success. When Plugin Table, Echo Blank
- How to translate this mySQL query to $wpdb query
- MySql query to get posts with all meta and terms
- Proper usage of $wpdb->update()?
- MySQL 5.5 upgrade ‘broke’ WordPress [closed]
- Separate DB by yearly archive of WordPress
- What should a WordPress developer know about MySQL? [closed]
- Copyright: Get first and last date of post type
- Update MySQL query so that it functions again
- Query posts by custom taxonomy and sort by post_modified
- WordPress $wpdb get posts from category and sort by custom meta
- Array Formation Issue
- Migration problems with mysql: Operation not allowed when innodb_forced_recovery > 0 [closed]
- wp_usermeta – Read from database, but save function broken
- WordPress $wpdb no result
- Delete all users with Editor role and their content mysql
- when using $wpdb sudden connection rejection without changing anything. Access denied, with errors from repair tool
- edit_user_created_user hook – using to update Groups
- Mysql Error in querying form entries in Gravity Form plugin
- Improving performance of SQL sub-queries in WordPress
- Missing latest posts and options after DB migration via phpMyAdmin
- Saving custom term value to the database in new table
- MySQL errors after a WordPress clone
- MYSQL Join on meta key value?
- Complicated MySQL Query
- problem with quotes on new post
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- mysqldump throws: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)
- How do I load a sql.gz file to my database? (importing)
- Batch Replace URLs in WordPress Database