Recently I have have received under my responsibility the company's wordpress site, suffers from extreme performance issues...
I have started investigating, installed Query Monitor and discovered several problemas:
Get_terms().
The site's theme use heavily this method in many shortcodes. All this shortcodes call get_terms and at the end, it sums up to 88K queries that slows the site dramatically.
If I'll replace the theme, or disable Polylang, the memory will shrink down from 260mb to 20mb-30mb.
I'm Adding a print of the site's query monitor. (removing the theme's name to protect its identity)
The slow query is this
SELECT t.*, tt.*
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt
ON t.term_id = tt.term_id
WHERE tt.taxonomy IN ('post_translations')
AND tt.count > 0
ORDER BY t.name ASC
I have managed several themes before. Never seen a theme that using so heavily get_terms().
Listen, I'm not a PHP guy. I'm a front man who does themes and enjoy it, but I think that in this case there is some problem of the way the method is called and I cant find out where.
As we can see in the print above, the plugin calls extend_shortcodes which calls get_terms() inside taxonomy.php. I was trying to find the expensive method call, and cannot seem to locate it.
Did anyone encountered a problem like that before? Does anyone has some tips to share? My site gets stuck too many times cause of this problem and I will apreciaste any help I can get.
