How to Fix: WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO `wp_usermeta`

Recently, when I was playing with the multisite feature of WordPress I came across this error WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (1, ‘primary_blog’, ‘1’) made by require_once(‘wp-admin/network/admin.php’), require_once(‘wp-admin/admin.php’), do_action(‘admin_init’), WP_Hook->do_action, WP_Hook->apply_filters, _wp_admin_bar_init, WP_Admin_Bar->initialize, get_active_blog_for_user, update_user_meta, update_metadata, add_metadata I understand that there is […]

Learn More »

Creating separate database table for Multisite WordPress

Recently, I have been struggling to get this right. Creating a separate database tables for Multisite. Multisite has option for “Network Activate”. When enabling the plugin, it should create a separate database table for each of the site. At the same time we also need to consider that it should be deleted when we “uninstall” […]

Learn More »