• Resolved cgzaal

    (@cgzaal)


    I created a new taxonomy which worked fine untill this week.
    Last week I posted 4 posts, all with the same term name,
    but these posts are not counted as published, so the term doesn’t
    show up in my (custom) index.
    In the taxonomy overview the term is counted as 0 (should be 4).
    The posts are published though, and the rewrite-url:
    /taxonomy-name/term-name shows the four posts correctly.
    I am puzzled:
    – is this a WordPress-thing?
    – is this due to the plugin not working properly?
    – or should I dive into the database?

    • This topic was modified 4 years, 1 month ago by cgzaal.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cgzaal

    (@cgzaal)

    I fixed it myself, by editing the database.
    Just edited the table wp_term_taxonomy, I reset the count in the relevant row.

    Plugin Author nwjames

    (@nwjames)

    @cgzaal,
    Thanks for raising this.
    You don’t define the specfic set-up you have, so I’ll describe how it works.

    If, under Terms Control, you select the default Standard, then this plug-in does nothing; standard WP processing is used.

    If you select either of the other options, then a plug-in routine is called to count the terms. This then calls the standard WP processing – but before calling it adds a process to modify the SQL query from (essentially)
    SELECT COUNT(*) FROM wp_posts WHERE post_status = 'publish' into
    SELECT COUNT(*) FROM wp_posts WHERE post_status IN ( <list of statuses> )

    So, if you’re using the standard option, then it cannot be a plug-in problem.

    It *may* be relevant to note that there is a ticket 40351 to be delivered in 5.6 that relates to improving the performance of this count process. In it, there is reference to wrong counts. Whether this is the case here, I cannot say.

    If the problem remains, please can you let me have more information on the specific taxonomy.

    Thanks,
    Neil James

    Thread Starter cgzaal

    (@cgzaal)

    Hi James,

    Thanks a lot for your extensive and instructive answer.
    I think you are right: the problem seems to be in the WP-counting process.
    The posts I made are set to be published in future, so they
    start off as being unpublished (uncounted), and after a certain moment they
    are automatically set to published. Somehow WP fails to (re)set the
    count of these posts. It may indeed be that this is due to a WP-update.
    I’ll check the references you mentioned.

    Thanks a lot, Chris

    Hi James,

    You instructions worked, however to see the counts I had to create a dummy test post first (so I already had 2 + the new posts properly displayed a count of 3, once I deleted the post the count correctly displayed 2) The final test was to recreate another test2 dummy post with that term and it indeed displayed a count of 3.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Counting error’ is closed to new replies.