Tag Groups - Free Plan

Tag Groups, Version 1.37.0: Logic Operator for Toggle Post Filter

The latest release of the Tag Groups WordPress plugin extends the REST API and adds to the post filter fine-grained logical operators and more.

Version 1.37.0 of the Tag Groups WordPress plugin was released, both for the premium and the free plans.

For developers: REST API

While the plugin offers endpoints for the WordPress REST API already since April 2018, they have been read-only. Completing the remaining parts allows developers now to edit taxonomies, groups and post tags through an external application.

These additional functions are available with both premium and free plans. For increased security you need to enable them through a constant in your wp-config.php file. Authentication can be done through the application password feature of the new WordPress release 5.6.

The new methods are still experimental and not officially supported.

Learn more in the documentation.

New features for the Toggle Post Filter

I’m excited to share three new options that make this post filter extremely powerful and customizable.

1. Fine-grained logic operators

Until now, three logic operators were available for the Toggle Post Filter:

  1. All tags across all groups are connected with “OR”.
  2. All tags across all groups are connected with “AND”.
  3. All tags inside each group are connected with “OR” and groups that contain tags are connected with “AND”.

For many projects that was insufficient and users needed a more flexible solution.

The parameter “operator” – available in the menu part or the Toggle Post Filter – now understands also a per-group definition of operators.((This is not yet available in the Gutenberg block, so if you are using a block you first need to transform it to a shortcode. All non-default settings will be preserved.))

Imagine the following search setup for a language school:

  • Group 1: languages
  • Group 2: levels
  • Group 3: additional features

While clients may want to search a course in English OR French (group 1), for beginners OR intermediate learners (group 2), they additionally need day care for their children AND wheelchair-accessible rooms. That means, we have AND to connect all the groups, and within the groups we use OR, OR and AND.

The general format of the parameter is:

operator="all:OPERATOR|group ID:OPERATOR|group ID:OPERATOR| ..."
  • You need at least one entry with the keyword “all”. The corresponding operator determines how the groups are connected.
  • OPERATOR can be AND or OR (upper or lower case). IN works like OR.
  • The order of groups doesn’t matter.
  • If you use this format of the operator, all groups that you don’t specify will fall back to the operator OR.
  • As usual, if you allow your visitors to select many tags, the database query will become increasingly complex. Although we are caching results, you may want to make sure that performance won’t become an issue.

For our example this translates to:

operator="all:and|1:or|2:or|3:and"

That’s as simple as it gets while giving you the full power of nested database queries.

And, of course, the past keywords AND, IN, OR and IN AND still work as before.

2. Only one tag per group

Another new option, available in shortcode and block, lets you determine groups where users should only be able to select one tag. When they select a second tag, the first one will be deactivated. The operator accepts a comma-separated list of group IDs. All of these groups must of course be available in the filter.

one_only_groups="3,6"

Please note that more tags might still be selected if this selection is carried over by the persistent filter setting from another page.

3. Multiple text search fields

The way how text search fields work has changed so that you can now show more than one on a page. The typed letters are synchronized across all text fields. The setting how to trigger the search (1: on enter, 2: on enter or stop typing) will use the highest number among all parameters. That means, if you want to search “on enter” only, all text search fields must use the setting 1.

[tag_groups_tpf_text_search placeholder="type here" search_trigger=1]

Further Information

Photo by Christoph Amthor

Christoph