Title: Misnumbered comments after migration
Last modified: September 18, 2025

---

# Misnumbered comments after migration

 *  [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [8 months, 3 weeks ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/)
 * Hi,
 * We recently completed a migration using WP Migration. Since migrating the database,
   we’ve had a weird problem with the comment counts on the dashboard being wrong:
   Sometimes they’re correct, but sometimes the displayed number of comments (including
   approved, spam, and trash) will be obviously wrong. Maybe the weirdest side effect
   is that after clearing spam or trash, the counts for those may display a negative
   number: For instance, at the moment, the spam folder said it has -21 comments,
   but if I click on that folder, there are four comments, and the display updates
   to -19. After a while, it’ll go back to displaying correctly, only to miscount
   again later.
 * Any idea how we can fix this? It did not happen pre-migration, so it seems to
   have something to do with the migrated database.
 * Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Delicious Brains Support](https://wordpress.org/support/users/dbisupport/)
 * (@dbisupport)
 * [8 months, 2 weeks ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/#post-18661871)
 * Hi [@ate-up-with-motor](https://wordpress.org/support/users/ate-up-with-motor/)!
 * WP Migrate Support Team here. Thanks for reaching out with your query! We would
   be happy to assist.
 * With WP Migrate Lite, you can export your database using the plugin and then 
   import it using a tool like phpMyAdmin. To help us understand the issue, could
   you confirm where exactly you’re seeing the incorrect comment counts, on the 
   source site or on the site where you’ve imported the database?
 * Also, did you perform a full database export, or only select specific tables?
 * We look forward to your response.
 *  Thread Starter [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [8 months, 2 weeks ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/#post-18662681)
 * This is on the destination site (the new site to which the old database was migrated),
   and we did a full database export. The comment misnumbering was not occurring
   on the old (pre-migration) site, but began to occur on the new site following
   the full migration.
    -  This reply was modified 8 months, 2 weeks ago by [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/).
 *  Thread Starter [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/#post-18702044)
 * This is still happening, so any suggestions or insights would be appreciated.
 * `could you confirm where exactly you’re seeing the incorrect comment counts, 
   on the source site or on the site where you’ve imported the database? Also, did
   you perform a full database export, or only select specific tables?`
 * If it wasn’t clear from my previous response, this is occurring on the destination
   site (it did not happen on the source site), and it was a full export, all tables.
 *  Plugin Support [Delicious Brains Support](https://wordpress.org/support/users/dbisupport/)
 * (@dbisupport)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/#post-18705982)
 * Hi [@ate-up-with-motor](https://wordpress.org/support/users/ate-up-with-motor/),
 * Thanks for letting us know. We haven’t seen this behavior reported before, and
   WP Migrate itself doesn’t modify comment data during export/import.
 * WordPress stores comment counts for each post in the `wp_posts.comment_count`
   column. These numbers are normally updated whenever comments are added, deleted,
   or change status.
 * If you have command line access with WP-CLI installed, you can try using: `wp
   comment recount`
 * More info here: [https://developer.wordpress.org/cli/commands/comment/recount/](https://developer.wordpress.org/cli/commands/comment/recount/)
 * This uses WordPress core functions and will update the dashboard numbers without
   affecting the actual comments.
 * Alternatively, you may create a script to loop through posts and call WordPress’
   function [wp_update_comment_count()](https://developer.wordpress.org/reference/functions/wp_update_comment_count/)
   for each post. There may also be plugins available that handle this.
 * Either way, we recommend trying these on a staging site where the same issue 
   occurs and creating a backup before making changes.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Misnumbered comments after migration’ is closed to new replies.

 * ![](https://ps.w.org/wp-migrate-db/assets/icon.svg?rev=2851356)
 * [WP Migrate Lite - Migration Made Easy](https://wordpress.org/plugins/wp-migrate-db/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-migrate-db/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-migrate-db/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-migrate-db/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-migrate-db/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-migrate-db/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Delicious Brains Support](https://wordpress.org/support/users/dbisupport/)
 * Last activity: [7 months, 1 week ago](https://wordpress.org/support/topic/misnumbered-comments-after-migration/#post-18705982)
 * Status: not resolved