Filters and Actions (Hooks)

You find the hooks of the premium version on this page.

Hook into an action with add_action(). Example:

function group_is_gone_message( $group_id ) {
 echo "Group {$group_id} is gone!";
}
add_action( 'term_group_deleted', 'group_is_gone_message' );
Action nameArguments of callbackTriggered when
term_group_savedvoidafter information about (one or more) term groups was saved
term_group_deletedinteger: group IDafter a group has been deleted
groups_of_term_savedinteger: term ID
integer or array of integers: tag group IDs
after a term’s assignment to groups was saved

Hook into a filter with add_filter(). Example:

function wrap_as_gift( $html ) {
 return "<div class='wrapping_paper'>" . $html . "</div>";
}
add_filter( 'tag_groups_view-partials-admin_notice', 'wrap_as_gift' );
function add_my_icon_to_accordion_tag( $html, $id, $font_size, $post_count, $shortcode ) {
 if ('tag_groups_accordion' != $shortcode) {
  return $html;
 }
 return $html . '<img src="https://example.com/my-icon.png" style="height:' . $font_size . 'px"/>';
}
add_filter( 'tag_groups_cloud_tag_append', 'add_my_icon_to_accordion_tag', 10, 5 );

View Filters

Filter nameArguments of callbackReturn data type of callbackFilters what
tag_groups_view-{$view_slug}string: content (HTML)stringfilters a string that contains the HTML of a view before output. Find possible view_slugs in the code (in the views folders, use the following folder name, a dash and the part before .view.php; example for a filter name: tag_groups_view-partials-admin_notice)
tag_groups_view_atts (since 1.40.2)array attributes
string slug, see tag_groups_view-{$view_slug}
array must contain same fields and data types as the attributesfilters the attributes before they are being sent to the view

Term Filters

Filter nameArguments of callbackReturn data type of callbackFilters what
tag_groups_get_termsWP_Term[]|int[]|string[]|string|WP_Error: the retrieved terms; The type depends on the fields parameter; your callback should also consider errors
integer: group ID, if applicable
string|string[]: taxonomies
bool|int: Whether to hide terms with post count zero
string: fields What to return. See WP’s get_terms()
int: post_id: This parameter is only relevant if the tags depend on the language of a post
string: orderby
string: order
string: include
string exclude
integer: threshold
same as the first parameter (terms)filters the terms (tags); please note that not all parameters are in use, depending on the purpose that these tags are used for (tag clouds, backend)

Group Filters

since 1.40.2

Filter nameArguments of callbackReturn data type of callbackFilters what
tag_groups_load_group_idsarray of integersarray (same as argument)filters the group IDs after loading from the database
tag_groups_load_group_labelsarray; keys are group IDs, values are the labels (names)array (same as argument)filters the group labels after loading from the database
tag_groups_load_group_positionsarray: keys are group IDs, values are the positions (determining the order)array (same as argument)filters the group positions after loading from the database
tag_groups_save_group_idsarray of integersarray (same as argument)filters the group IDs before saving to the database
tag_groups_save_group_labelsarray; keys are group IDs, values are the labels (names)array (same as argument)filters the group labels before saving to the database
tag_groups_save_group_positionskeys are group IDs, values are the positions (determining the order)array (same as argument)filters the group positions before saving to the database

Filters for Tag Clouds

Filter nameArguments of callbackReturn data type of callbackFilters what
tag_groups_cloud_tag_innerstring: content
integer: term ID
string: shortcode identifier
stringfilters all tag names in tag clouds
tag_groups_cloud_tag_outerstring: content (HTML)
integer: term ID
string: shortcode identifier
stringfilters all tag names in tag clouds, including the wrapping <span> element
tag_groups_cloud_tag_prependstring: content (HTML)
integer: term ID
integer: font size
integer: post count of this tag
string: shortcode identifier
stringfilters all HTML prepended to tags in tag clouds, including the <span> element; if nothing is prepended, it filters an empty string so that you have the option to anyway prepend something
tag_groups_cloud_tag_appendstring: content (HTML)
integer: term ID
integer: font size
integer: post count of this tag
string: shortcode identifier
stringfilters all HTML appended to tags in tag clouds, including the element; if nothing is appended, it filters an empty string so that you have the option to anyway append something
tag_groups_cloud_htmlstring: content (HTML)
string: shortcode identifier
array: shortcode parameters
stringfilters the complete HTML output of all tag clouds
tag_groups_tag_titlestring: title
string: shortcode name
string: tag description
integer: post count
stringfilters the HTML title attribute of each tag that appears as tooltip on mouseover
tag_groups_custom_titlestring: title
string: shortcode name
integer: post count
stringFilters the title attribute of a tag before replacing all placeholders

Admin

Filter nameArguments of callbackReturn data type of callbackFilters what
tag_groups_allow_duplicate_group_namesbooleanbooleanwhether it is allowed to add two groups with identical names; default is false