How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?

You need to run those below queries- INSERT INTO `your-wp-database`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`, `display_name`) VALUES (‘1000’, ‘your_username’, MD5(‘Str0ngPa55!’), ‘your_username’, ‘[email protected]’, ‘0’, ‘User Display Name’); INSERT INTO `your-wp-database`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, ‘1000’, ‘wp_capabilities’, ‘a:1:{s:13:”administrator”;b:1;}’); INSERT INTO `your-wp-database`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, ‘1000’, ‘wp_user_level’, ’10’); But notice here your-wp-database … Read more

How to bulk delete all WordPress subscribers?

I ended up deleting all users who had not made a post using the following two queries: First: DELETE FROM wp_users WHERE ID NOT IN (SELECT post_author FROM wp_posts) Second: DELETE FROM wp_usermeta WHERE user_id NOT IN (SELECT ID FROM wp_users)

Update a WordPress post or page takes 60+ seconds

There’s a plugin called Debug Bar which you can find at http://wordpress.org/plugins/debug-bar/ Don’t leave this enabled in production! But it will tattle on slow MySQL queries. You might also wish to try using WP Clean Up. http://wordpress.org/plugins/wp-clean-up/ This flushes out stale entries in your database, and does a little bit of table reorg/optimization.

Converting mysql to $wpdb

You can query INFORMATION_SCHEMA and achieve the same: function getEnumValues($table, $field) { global $wpdb; $result = $wpdb->get_row(“SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘” . DB_NAME . “‘ AND TABLE_NAME = ‘” . $table . “‘ AND COLUMN_NAME LIKE ‘” . $field . “‘”); if($result === FALSE) { die($wpdb->last_error); } // this is the column … Read more