The latest version of the Tag Groups WordPress plugin (premium plan) comes with a new logic operator for the real-time post filters Toggle Post Filter and Dynamic Post Filter.
Logic operators might sound a bit technical, but it’s them that make live post filters really powerful and customizable. You might say that they define the question you ask when searching for posts. The plugin then sends you the answer in the shape of a list of posts.
Until now you were able to use the logic operators OR
(alias IN
) and AND
to connect tags within a group and then all groups. When we search for matching posts, we test each post if one or more of the selected tags appear in the correct group among the post tags. If all conditions are met, this post joins the queue for display.
Now, I added a third operator: EXACT
. This operator means that all selected tags of a group must exactly match the post tags in that group. The same tags, not more and not less.
Example: Database of Countries
Imagine that our posts represent countries and their tags (in a language group) describe their official (or national) languages. One post is India with language tags Hindi and English, another one Ireland with language tags English, Irish, Ulster Scots and Shelta and a third one Australia with just English.
If we now search with the operator “OR” and select the English tag in the post filter, we naturally see India, Ireland and Australia popping up. No surprise here.
If we, however, use the new operator “EXACT” and select again English in the post filter, the list of posts shows only Australia. If we then add Hindi to the selection, Australia disappears from the list and India appears. That is because only India has both of these tags in its language group.
You can use the keyword “EXACT” as operator (which means that “EXACT” works on all group levels and then all groups are connected with “AND”) or you use the detailed format like
operator="all:and|1:or|2:or|3:exact"
The new operator “EXACT” is available both in the Gutenberg block and in the shortcode. The detailed per-group format works only with the shortcode.
New filters for the free and premium versions
If you are a developer you can utilize two new filters that let you modify the HTML segments that come before and after each tag in the plugin’s tag clouds. The filter will be called for each tag and we submit some additional useful data like post count and font size.
You find a description in the documentation.
Bug fixes and small improvements
Of course I also fixed some bugs and improved some styling in the post filters. You find it all in the change log.
Further Information
- Tag Groups main page
- Tag Groups (premium) change log
- Tag Groups (free) change log
- How to update Tag Groups (premium)
Photo by Christoph Amthor