• Ate Up With Motor

    (@ate-up-with-motor)


    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

    (@dbisupport)

    Hi @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

    (@ate-up-with-motor)

    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.

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    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

    (@dbisupport)

    Hi @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/

    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() 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)

You must be logged in to reply to this topic.