Hi @freddredirl ,
Can you send us a link to where we can see this in action?
Best,
Cena
More info – I have since discovered that there was a job import script created to import the jobs from a CRM. It was working fine until just recently but now the script imports the jobs but the jobs dont seem to show up in the category count as they are ZEro. But if I click on the ZERO I can see the jobs ok within the category. The workaround is to manually assign a job to a user, hit Save and then the count works. I am wondering if you can share any info that might help us fix the code?
Hey @freddredirl – it sounds like the problem is that when the import script happens, it doesn’t recalculate the term counts. I would suggest using a function like wp_update_term_count
in your script so that the term counts are updated.
When you manually assign a job to a user, what’s happening is that the job listing is being saved, which triggers a term count, which updates the term count number for the job.
Hope this helps!
Hi – this worked! Just one more query
When updating the list of jobs now, after the script runs if there are any jobs deleted they seem to persist in the cache until a job is updated manually which then resets the cache in the wp_options database table. Is it safe to delete these rows when the script runs, or if there is another function used to clear the cached posts from the wp_options table.
@freddredirl you can try using wp_cache_flush to clear the object cache.