Alternatively, is there some code that I can run manually to ‘recount/refresh’ the user taxonomy count?
Thanks.
yes this is a problem the issue is that thsi plugin fills in most of the gaps that wordpress has on user taxonomies but not all.
The saving grace is that the count will fix itself if that term is allocated to another user (as the count does run when users have their terms assigned or removed).
Anway I will get to adding this feature at some stage but I need to think about how to do it elegantly.
but in the mean time you could
$terms = get_terms( ‘your_taxonomy’, array(
‘hide_empty’ => false,
) );
foreach ( $terms as $term ) {
$lh_user_taxonomies_instance->update_count($term->term_id, ‘your_taxonomy’);
}
Great thanks – that certainly seems to fix it on the default installation I tried it out on.
I can add it to an obscure private page and then visit that from the front end when I need to reset to clear out the dummy data I’m testing out the functionality with..
Sorry, scratch that – I’m having some issues with getting that to work in whichever place I try to hook it into.
It just returns an error:
Fatal error: Uncaught Error: Call to a member function update_count() on null
If I echo $term->$term_id just before that line then I get the list of IDs that I’d expect.
Thanks,
Ben
Your problem is probably that you are running this inside a function. If so you need to declare $lh_user_taxonomies_instance as a global before utilising the class object. Thus
global $lh_user_taxonomies_instance;
@badlydrawnben have you had a chance to look at this?
Adding thirst line of code at the top of your function should suffice…
Yes sorry, I didn’t reply back.
Works great.
Thank you.
Excellent I’m resolving for good order.
Pete