Support » Fixing WordPress » Comment IDs set to null

  • Resolved Ate Up With Motor



    I recently migrated my website from another CMS to WordPress. In the process, I imported comments from the previous system. For various reasons, I was unable to use any importer system, so I had to actually reformat the comments table to match WordPress’s and then import it directly to the database from phpMyAdmin.

    That appears to have worked, but now I’m noticing a peculiar problem: If new comments are created from WordPress, their comment_ID is set to NULL. Possibly as a result, I can’t delete, edit, or mark those comments as spam from within WordPress; I have to go to the table and edit that row directly.

    The only thing I can think is that there might be an issue with the imported comment_ID numbers not being sequential (there are some IDs that are skipped because they were for spam or deleted comments that I didn’t bother to import).

    How can I fix this problem? I suppose I could renumber the list of imported comments sequentially, not skipping any numbers, but that would be a lot of work because I’d also have to make sure the parent IDs were updated concurrently, and in any case I’m not sure it would help. I would obviously rather not have to keep going into the table every time I need to approve or delete a comment!

Viewing 1 replies (of 1 total)
  • Okay, I figured out the problem: When you import a table not originally created in a WordPress database, it doesn’t have the correct MySQL settings. You have to manually set the parameters for each field from phpMyAdmin, including setting the key ID so that the comment_ID will auto-increment. Fortunately, I had an unmolested WordPress comment table I could look at to see how each field needed to be set.

    Once done, the problem was resolved for new comments, although any existing comments with NULL values remained that way. Fortunately, since they were all spam, I could just delete them from the table.

Viewing 1 replies (of 1 total)
  • The topic ‘Comment IDs set to null’ is closed to new replies.