A word of WPML caution when using wp_defer_term_counting(true);

By.

min read

My profile

Share this:

First read

https://wordpress.stackexchange.com/questions/219975/is-there-a-downside-of-using-wp-defer-term-counting
https://wordpress.stackexchange.com/questions/316777/how-to-update-incorrect-post-count-in-taxonomy
https://wordpress.stackexchange.com/questions/219975/is-there-a-downside-of-using-wp-defer-term-counting

Are your wondering … why even when you added wp_defer_term_counting(true); WP is STILL indexing/counting your terms? Take a look at your WPML core files.

WPML checks if the counting has been disabled and uses the shutdown hook to do it anyway …

So we need to unhook that as well using:

global $wpml_post_translations;
remove_action( 'shutdown', [ $wpml_post_translations, 'shutdown_action' ], PHP_INT_MAX );
Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *