While converting a website from single to multisite I bumped into an issue while creating accounts. When looking into the logs I noticed:
WordPress database error Unknown column ‘spam’ in ‘field list’ for query INSERT INTO wp_users
The issue is clear, i’m missing the ‘spam’ column in wp_users. Since i’m running this environment in Docker and I didn’t have easy database access available I wrote a wp-cli command fixing this issue;
Thanks to RJT for improving the script!
Uchechukwu Ajuzieogu says
Hi Marinus,
I am facing the same issue in WordPress Bitnami Stack, how do I do this, is there is step by step guide, I’m not familiar with CLI of WP.
Thank you
Marinus Klasen says
Hi there – you can access your database and run the following command: ALTER TABLE wp_users ADD spam TINYINT
Shammy says
Thank You! It work for me.
Sophia says
Thanks so much for this.. It worked
Ronnie Roberts says
When I run that command, with root user, I receive the error:
“Invalid default value for ‘user_registered'”
Any thoughts?
Marinus Klasen says
Seems like something is wrong with the user_registered column in your table. I would have to have a look myself in order to give further advice. Feel free to reach out by email!
jld says
Thanks to your article, I solved my issue, thank you very much !
Marinus Klasen says
Happy to hear that!
RJT says
Important addition: the database column should default to 0 not null, so the query should be:
ALTER TABLE wp_users ADD spam TINYINT NOT NULL DEFAULT 0;
If the spam column is missing, it’s likely the the ‘deleted’ column is also missing (both should be added when converting to multisite). This should column also needs to be added.
ALTER TABLE wp_users ADD deleted TINYINT NOT NULL DEFAULT 0;
Marinus Klasen says
Thanks! I’ve updated the script according to your recommendations.
AGGnet says
Thank you very much, you have saved my life with a multisite. It works perfectly
Marinus Klasen says
Glad to hear that!
Bloggista says
Hey thanks for this bro! I got same problem —- members not displaying in BP – Members page, and new users activation error “invalid activation key”. Got all resolved!
Tim says
Thank you! You saved my day