• Resolved parakeet

    (@parakeet)


    I think LH User Taxonomies is causing erroneous post counts for terms in the taxonomy to which my Users are attached.

    Namely, my “company” taxonomy, which is now shared by several Post Types (ie. “Article”, “Viewpoint”) and the Users.

    When I try to display the count of a term like $topmost->count, sadly it is 0.
    Trying to fix it with wp_update_term_count_now does NOT successfully update the counts – UNTIL I disable the LH User Taxonomies plugin.

    Some kind of conflict going on here?

    I’m going to need to fix it, because I would like to have both a User and Post Types utilising said “company” taxonomy at the same time. Is it possible?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter parakeet

    (@parakeet)

    In fact, it’s worse than that… it’s not that wp_update_term_count_now actually fixes the count…

    Re-enabling LH User Taxonomies has the same effect… term counts displayed all go back to 0! ??

    Thread Starter parakeet

    (@parakeet)

    I believe this is because, with LH User Taxonomies enabled, $term->count returns a count of Users with this term, not of Posts.

    This is an incorrect assumption for my use case.

    Need a way to differentiate the count, or I’m going to have to write another way to force counting of posts, ie. do a corresponding WP_Query and do found_posts – but seems like a shame that would introduce extra load.

    Any ideas, please?

    https://github.com/shawfactor/lh-user-taxonomies/pull/7#issuecomment-484405082

    Plugin Author shawfactor

    (@shawfactor)

    yes it does and I’m not sure there is a solution I want to implement.

    As it is sharing taxonomies across users and post objects is problematic anyway as wordpress has no way of telling if the object id is for an user or post so even if you do two queries on the shared taxonomy then the count you come up with could be wrong anyway.

    Plugin Author shawfactor

    (@shawfactor)

    I am resolving this for good order, note I′ve yet to look at the other issue which I suspect is a solvable bug.

    pete

    Plugin Author shawfactor

    (@shawfactor)

    That being the isue you added regarding removing terms on users, in the other thread.

    Thread Starter parakeet

    (@parakeet)

    I recently disabled LH User Taxonomies and moved the user taxonomy piece to an ACF field on User.

    This means the taxonomy, which remains registered to a Post Type, is uninterrupted by also being registered to a User.

    It’s a shame not to accomplish it all through LH User Taxonomies, and the ACF piece will also cause a certain elegance or complication for me – but, as you say, WordPress seem to struggle with facilitating it.

    Thanks.

    Plugin Author shawfactor

    (@shawfactor)

    @parakeet that won′t work.

    As i said if you share a taxomony between posts and users then you cannot get an accurate term count. It is impossible as there is nothing in the database that flags the relationship as being post or user related and posts and users are in two different tables

    The only solution is to make sure taxonomies only relate to a objects in a single database table.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin causes 0 term count’ is closed to new replies.