Filters and Actions (Hooks)

The filter hooks and action hooks of the premium version are only available if the plan enables the corresponding feature. You find the hooks of the free 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(). Examples:

function wrap_as_gift( $html ) {
 return "<div class='wrapping_paper'>" . $html . "</div>";
}
add_filter( 'tag_groups_post_terms', '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 );
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_premium_view-{$view_slug}string: content (HTML)stringsee tag_groups_view-{$view_slug}; These are the views int the /premium/views folder; example for a filter name: tag_groups_premium_view-shortcodes-tpf_menu_slider_button
tag_groups_post_termsstring: content (HTML)stringfilters a string containing the table of post tags, in TagGroups_Premium_API::post_terms
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_prepend (since 1.38.3)string: 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_append (since 1.38.3)string: 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_template_custom_fieldmixed: value returned by get_post_meta()
string: custom field name
integer: post ID
string or array of strings1filters the value of a custom field for output in a post template for the placeholder {custom_field:…} in the Toggle Post Filter, Dynamic Post Filter or Post List
tag_groups_tag_titlestring: title
string: shortcode name
string: tag description
integer: tag count
stringfilters the HTML title attribute of each tag that appears as tooltip on mouseover
tag_groups_excerpt (since version 1.36.4)object: WP_Post objectstringUse a callback function to create a custom excerpt for the placeholder {post_excerpt} in a post template in the Toggle Post Filter, Dynamic Post Filter or Post List. The function needs to take care of proper encoding and sanitation and it must make sure that HTML is self-consistent and that no tags remain open.

Footnotes

  1. array of strings will be concatenated to a comma-separated list[]
Previous

Constants

Next

REST API