Query Loop Advanced Operators adds a Logic control to the Query Loop block, so you choose how its taxonomy filters combine: match any term, match all terms, or exclude terms entirely.
Before you start
- WordPress 5.8.3 or later
- PHP 5.6 or later
- The block editor. The control is added to the core Query Loop block.
Install
- In your WordPress dashboard, go to Plugins → Add New Plugin.
- Click Upload Plugin.
- Choose the plugin zip file.
- Click Install Now.
- Click Activate.
There’s no settings page. Everything happens on the block.
How to use
Choose how filters combine
- Add a Query Loop block, or select one you already have.
- Make sure the loop uses a custom query, not the template’s query. The Logic panel is hidden when the loop inherits its query from the template.
- Use the Query Loop’s own filters to pick the categories, tags or other taxonomy terms you want.
- In the block settings sidebar, open the Logic panel.
- Choose Include, Exclude or Overlap.
- Save. The editor preview and the front end both use the logic you chose.
Logic only changes taxonomy filters. If you haven’t picked any terms, it has nothing to act on.
Block options
The Logic panel has one control with three choices. Default: Include.
- Include: shows posts that have any of the selected terms. This is the Query Loop’s normal behavior.
- Exclude: shows posts that have none of the selected terms. Handy for “everything except this category.”
- Overlap: shows only posts that have all of the selected terms at once. For example, pick the categories “Dinner” and “Vegetarian” to show only posts in both.
The choice applies to every taxonomy filter on that loop. If you filter by both categories and tags, the same logic is used for each.
Developer reference
Coming soon: the hooks, filters and functions you can use with this plugin from your theme or a code snippet.
FAQs
Why don’t I see the Logic panel?
The panel only appears on a Query Loop that uses its own query. When the loop is set to inherit the query from the template (common on archive and blog templates), the panel is hidden.
Does it work with custom taxonomies?
Yes. The logic is applied to every taxonomy filter set on the loop, not just categories and tags.