Title: Call the recount terms function in code
Last modified: August 29, 2019

---

# Call the recount terms function in code

 *  Resolved [Niek](https://wordpress.org/support/users/nvomedia/)
 * (@nvomedia)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/call-the-recount-terms-function-in-code/)
 * For some reasons, the category count on the homepage on a webshop which I manage
   loses his count after sometime.
    After running the ‘Recount Terms’ function in
   the WordPress Admin Area > WooCommerce > System Status > Tools, the counts come
   back.
 * Now I’m looking to run this function, let say, every hour, with an WP Cronjob
   to make sure that there will be always some counts.
 * I know how to create an Cronjob, how can I call that Recount function in my code?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/call-the-recount-terms-function-in-code/#post-11880976)
 * The code for this is in:
    /wp-content/plugins/woocommerce/packages/woocommerce-
   rest-api/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.
   php lines 484 – 499 so just copy those lines into your own function.
 *  Thread Starter [Niek](https://wordpress.org/support/users/nvomedia/)
 * (@nvomedia)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/call-the-recount-terms-function-in-code/#post-11882119)
 * Thanks! Found it, and used it!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Call the recount terms function in code’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [count](https://wordpress.org/support/topic-tag/count/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [terms](https://wordpress.org/support/topic-tag/terms/)

 * 2 replies
 * 2 participants
 * Last reply from: [Niek](https://wordpress.org/support/users/nvomedia/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/call-the-recount-terms-function-in-code/#post-11882119)
 * Status: resolved