• Hello WP Community,

    I am trying to do something that in my head should be simple, but not seeing options within the plugins / widgets I have.

    I have a variety of tags that are sort of different categories, so when displaying a tag cloud, i’d like to select which ones I display. For example, I have Rating, Theme, States that are all blended, and just want to select a list of tags to display.

    Not seeing a plugin or easy option to add/remove certain tags from a cloud.

    Any help would be appreciated!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The solution depends on how the cloud is generated. It’s sometimes possible to alter the args passed to the function to get the results you want. If get_terms() or WP_Term_Query are used to get the tags, the ‘pre_get_terms’ action can be used to alter the query vars used. Setting an “include” or “exclude” query var will let you specify which tags will appear in the cloud. Or set and unset other query vars to get the query results you want.

    The main problem with this action hook is all term queries go through it. You’ll need to discern a tag cloud query from any others. The nature of other query vars can help with this.
    https://developer.wordpress.org/reference/hooks/pre_get_terms/
    https://developer.wordpress.org/reference/classes/wp_term_query/__construct/

Viewing 1 replies (of 1 total)

The topic ‘Wnat to display only certain tags in a cloud’ is closed to new replies.