Forums

[resolved] Post Categories miscount (2 posts)

  1. roro
    Member
    Posted 4 years ago #

    I just convert a phpnuke database to wordpress, everything worked fine, at least I thought, but now the post count in the categories is wrong.

    The converter script counted the categories after it finished:
    - 34 : 927
    - 35 : 82
    - 33 : 600
    - 10 : 540
    - 32 : 331
    - 22 : 9
    - 25 : 377
    - 29 : 821
    - 31 : 398
    - 37 : 276
    - 38 : 49
    - 39 : 183
    - 40 : 61

    But In the wp I have this:
    * blogs (6)
    * chistes (11)
    * deportes (4)
    * Ingles (36)
    * juegos (4)
    * nacional (14)
    * Oldies (5)
    * otros (15)
    * peliculas (20)
    * quotes (4)
    * Rumores (25)
    * tech (15)
    * tv (23)

    A lot of posts are missing in that count, I checked the database and the post are there with the correct categorie number, a counted post and an uncounted post looks the same in the database (wp_posts).

    How can I fix this? Any Ideas? What table is the one that makes the count?

    Thanks

  2. ohsheglows
    Member
    Posted 3 years ago #

    I imported from wordpress.com but I have version 2.7 and this query worked for me to fix the count number as my counts were all off after the import as well.

    UPDATE wp_term_taxonomy
    SET wp_term_taxonomy.count =
    (SELECT count(wp_term_relationships.term_taxonomy_id)
    FROM wp_term_relationships, wp_posts
    WHERE wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    AND wp_term_relationships.object_id = wp_posts.ID
    AND wp_posts.post_type = 'post')

    Hopefully that will fix it. You may want to do a backup just in case, but the only thing this query can do if it doesn't work would be mess up your count (which is already messed up).

Topic Closed

This topic has been closed to new replies.

About this Topic