• Resolved Rodrigo Salles

    (@roosalles)


    Hey there, thanks for the awesome work on the plugin, it’s very helpful!

    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)

    This is the query:

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Term Display – Max terms to display not working correctly’ is closed to new replies.