You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our website, we have created a custom taxonomy for better organizing our posts.
This taxonomy contains 15 terms. We are using the “Terms Display” feature for displaying a terms cloud based on the number of posts associated to each term (counter). The Maximum Terms to display is set to 45 (default value).
For some reason, when the cloud is rendered on the page, only 2 terms show up.
Inspecting/debugging the code, I noticed that the query that retrieves the terms from the DB is returning several duplicates for each of the 15 terms:
/simple-tags/inc/class.client.tagcloud.php line 886 (version 3.6.0)
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id WHERE 1 = 1 AND tt.taxonomy IN ('usdm_solution') AND tr.object_id IN ( SELECT DISTINCT ID FROM wp_posts AS p WHERE post_type = 'post' ) ORDER BY tt.count desc
If I run this query in phpMyAdmin, this is the result (I recorded a video): https://take.ms/D0Erb
Basically, each term is repeated the exact number of times of its count number, for example:
– Term “managed-services” is repeated 2 times (count == 2)
– Same for term “ai-ml-strategy” (count == 2)
– Term “cybersecurity” is repeated 3 times (count == 3)
– Term “processx” is repeated 6 times (count == 6)
and so on..
In this case, the resulting $terms array has 153 items (including all duplicates for all terms) and, since the limit is 45, the final sliced $terms array won’t contain all the terms, therefore, not all of them show up on the page.
Not sure if this is the correct behavior of the plugin or it’s a problem on my end, but I would appreciate any help. Thanks!
The text was updated successfully, but these errors were encountered:
https://wordpress.org/support/topic/term-display-max-terms-to-display-not-working-correctly/
/simple-tags/inc/class.client.tagcloud.php line 886 (version 3.6.0)
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id WHERE 1 = 1 AND tt.taxonomy IN ('usdm_solution') AND tr.object_id IN ( SELECT DISTINCT ID FROM wp_posts AS p WHERE post_type = 'post' ) ORDER BY tt.count desc
The text was updated successfully, but these errors were encountered: