A WordPress block that adds interactive taxonomy filtering capabilities to Query Loop blocks. This plugin allows visitors to filter posts displayed in a Query Loop by categories, tags, or custom taxonomies without page reloads.
- Interactive Filtering: Add dropdown filters for any taxonomy (categories, tags, custom taxonomies)
- No Page Reloads: Uses WordPress Interactivity API for smooth, instant filtering
- Block Editor Integration: Seamlessly integrates with the WordPress Query Loop block
- Responsive: Works on all devices and screen sizes
- Developer Friendly: Clean, extendable code with hooks and filters
- WordPress 6.6 or higher
- PHP 7.2 or higher
- A theme that supports the WordPress Block Editor
- Go to Plugins → Add New in your WordPress admin
- Search for "Taxonomy Query Filter"
- Click Install Now and then Activate
- Download the plugin zip file
- Go to Plugins → Add New in your WordPress admin
- Click Upload Plugin and select the zip file
- Click Install Now and then Activate
- Clone the repository to your
wp-content/pluginsdirectory - Install dependencies:
npm install - Build the plugin:
npm run build - Activate the plugin in WordPress admin
npm run start- Start WordPress development environment with xDebugnpm run stop- Stop WordPress development environmentnpm run build- Build production assetsnpm run watch- Watch files for changes during developmentnpm run test:unit- Run unit testsnpm run plugin-zip- Create plugin zip file for distribution
Note: The development environment includes xDebug support and VSCode launch configuration for PHP debugging.
- Add a Query Loop Block: Start by adding a Query Loop block to your page or post
- Insert the Taxonomy Query Filter: Inside the Query Loop block, add the Taxonomy Query Filter block
- Configure the Filter: In the block settings, select which taxonomy you want to filter by (categories, tags, or custom taxonomies)
- Publish: Save and publish your page - visitors can now filter the displayed posts
Here's a simple example that creates a filterable post list:
- Create three posts, each assigned to a unique category
- Create a new page
- Add the following block markup (copy and paste directly into the editor):
<!-- wp:query {"queryId":23,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"taxQuery":{"category":[],"post_tag":[]},"parents":[],"format":[]}} -->
<div class="wp-block-query">
<!-- wp:twentybellows/taxonomy-query-filter /-->
<!-- wp:post-template -->
<!-- wp:post-title /-->
<!-- /wp:post-template -->
</div>
<!-- /wp:query -->The filter works with any registered taxonomy. Simply select your custom taxonomy from the block settings.
You can add multiple Taxonomy Query Filter blocks within the same Query Loop to filter by different taxonomies simultaneously.
The filter uses standard WordPress classes and can be styled with CSS. The main wrapper has the class .wp-block-twentybellows-taxonomy-query-filter.
To test the plugin in a quick environment with the Plugin Checker:
npm install
npm run build
npm run plugin-zip
npm run plugin-testThis will:
- Build the plugin assets
- Create
taxonomy-query-filter.zip - Extract to
/release/taxonomy-query-filter/ - Launch a WordPress Playground instance for testing
Note: No Docker required - only Node.js is needed for the test environment.
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow WordPress Coding Standards
- Write unit tests for new features
- Update documentation as needed
- Test in multiple browsers
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Support Forum: WordPress.org Support
This plugin is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Developed by Twenty Bellows