Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Terms Cloud not listing all terms #1390

Closed
stevejburge opened this issue May 4, 2022 · 1 comment · Fixed by #1582
Closed

Display Terms Cloud not listing all terms #1390

stevejburge opened this issue May 4, 2022 · 1 comment · Fixed by #1582

Comments

@stevejburge
Copy link
Collaborator

https://wordpress.org/support/topic/term-display-max-terms-to-display-not-working-correctly/

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!

@stevejburge stevejburge added this to the 3.6.2: More Terms Screen milestone May 4, 2022
@stevejburge stevejburge changed the title Possible but with Maximum Terms to Display Possible bug with Maximum Terms to Display May 4, 2022
@stevejburge
Copy link
Collaborator Author

One more report on WordPress.org: https://wordpress.org/support/topic/cloud-not-listing-all-terms/

@ojopaul ojopaul changed the title Possible bug with Maximum Terms to Display Display Terms Cloud not listing all terms Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant