• Hello guys,

    My website is slow and Im trying everything to fix the speed, Im using woocommerce.
    I installed Query Monitor and it shows 22 slow queries all of them has something to do with get_terms()

    Screenshot of Query Monitor:
    https://prnt.sc/j5zmy7

    Screenshot of my “term_taxonomy” table:
    https://prnt.sc/j5znvz

    Screenshot of my “terms” table:
    https://prntscr.com/j5znp9

    Could this be related to my hosting or because I have many terms, I have deleted all tags, used Sweep plugin and WP-Optimize plugin but still no change.

    Any hints I will appreciate, Thanks ??

    • This topic was modified 6 years, 11 months ago by Amine CH.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow reply. You need some sort of object cache to save the results of get_terms() without having to make computationally expensive queries every time. The exact implementation depends on the nature of your need for get_terms(). Your code would be modified to first attempt to get terms from the object cache. Only when that fails is get_terms() called, after which the results are cached for future use.
    https://codex.www.ads-software.com/Class_Reference/WP_Object_Cache

Viewing 1 replies (of 1 total)
  • The topic ‘22 Slow Queries: WP_Term_Query-> get_terms()’ is closed to new replies.