lightweight-term-count-update icon indicating copy to clipboard operation
lightweight-term-count-update copied to clipboard

Consider edge cases around wp_defer_term_counting()

Open mboynes opened this issue 8 years ago • 1 comments

From #2 (direct link to comment):

I like the idea and it seems to be working fine. I'm just not sure whether we should not check whether the counting is still deferred right before running our SQL queries. While checking whether wp_defer_term_counting() is still returning true might be a quick solution, it does not seem to be bulletproof.

We could perhaps hook the edited_term_taxonomy or edit_term_taxonomy actions and check whether they were called for the term and taxonomy we are currently updating before running our updates.

mboynes avatar Mar 28 '17 16:03 mboynes

Looking into this, I have found out that the wp_defer_term_counting is being used in wp_nav_menu_update_menu_items

I'm going to dig into it and figure out what are the consequences of this. In case it least to messed up counts, I'm going to write tests and some mitigating logic.

david-binda avatar Mar 29 '17 11:03 david-binda