Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

January 14, 2021

Fix for missing spam column in wp_users

Marinus Klasen

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!

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

Looking for a WordPress expert?
Hire top notch developers on Codeable!

Consult an expert

Comments

  1. Uchechukwu Ajuzieogu says

    June 7, 2021 at 8:37 am

    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

    Reply
    • Marinus Klasen says

      June 7, 2021 at 9:29 am

      Hi there – you can access your database and run the following command: ALTER TABLE wp_users ADD spam TINYINT

      Reply
      • Shammy says

        May 23, 2022 at 10:49 am

        Thank You! It work for me.

        Reply
      • Sophia says

        July 22, 2022 at 9:22 pm

        Thanks so much for this.. It worked

        Reply
  2. Ronnie Roberts says

    September 10, 2021 at 6:59 pm

    When I run that command, with root user, I receive the error:
    “Invalid default value for ‘user_registered'”

    Any thoughts?

    Reply
    • Marinus Klasen says

      September 10, 2021 at 7:09 pm

      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!

      Reply
  3. jld says

    October 13, 2021 at 3:07 pm

    Thanks to your article, I solved my issue, thank you very much !

    Reply
    • Marinus Klasen says

      October 19, 2021 at 9:32 am

      Happy to hear that!

      Reply
  4. RJT says

    June 22, 2022 at 4:06 pm

    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;

    Reply
    • Marinus Klasen says

      June 22, 2022 at 4:50 pm

      Thanks! I’ve updated the script according to your recommendations.

      Reply
    • AGGnet says

      February 18, 2023 at 5:22 pm

      Thank you very much, you have saved my life with a multisite. It works perfectly

      Reply
      • Marinus Klasen says

        March 22, 2023 at 12:50 pm

        Glad to hear that!

        Reply
  5. Bloggista says

    July 17, 2022 at 11:12 am

    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!

    Reply
  6. Tim says

    August 13, 2024 at 9:59 am

    Thank you! You saved my day

    Reply
  7. bill says

    January 26, 2025 at 12:25 pm

    Thank goodness for this article. I migrated my single site to multisite using Migrate Guru and it went perfectly well except for this problem. I banged my head against the wall for hours but now it’s fixed. Thanks!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get in touch

Contact me using the details below

Marinus Klasen

Wilhelmina van Pruisenweg 35, 2595 AN Den Haag

marinus@mklasen.com
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Elementor Widget UsageMarch 27, 2025
  • Programmatically showing popups with ElementorMarch 25, 2025
  • The Elementor sanitize_settings errorSeptember 12, 2024
  • Announcing.. Wooping Shop Health!June 13, 2024
  • Swiper setup when using wp-scriptsMarch 14, 2024

Copyright © 2025 ยท Marinus Klasen | Webdesign by Team Rood