Pikari Gutenberg Query Filter
Wordpress Gutenberg filter and sorting controls for the query loop block using the interactivity API. Also modifies the core/search block
by Pikari Inc. · github.com/hellopikari/pikari-gutenberg-query-filter · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/hellopikari/pikari-gutenberg-query-filter/releases/download/v0.1.13/pikari-query-filter-v0.1.13.zipReadme
Pikari Gutenberg Query Filter
A WordPress plugin that adds advanced filtering capabilities to Query Loop blocks using the WordPress Interactivity API.
Features
- Search Integration: WordPress core search blocks automatically work within Query Loop blocks
- Post Type Filtering: Filter posts by one or multiple post types
- Taxonomy Filtering: Filter by categories, tags, and custom taxonomies
- Author Filtering: Filter posts by author with cached author lists
- Sort Controls: Sort by date, title, and other post fields
- Advanced Query Loop Support: Works with both core Query Loop blocks and Advanced Query Loop by Ryan Welcher
- Client-Side Filtering: Fast, AJAX-free filtering using WordPress Interactivity API
- Context-Aware: Automatic detection of inherited vs custom queries
- URL-Based State: Filter state persists in URLs for sharing and bookmarking
Requirements
- WordPress 6.8 or higher
- PHP 8.4 or higher
- Modern browser with JavaScript enabled
Installation
From WordPress Admin
- Download the plugin ZIP file from the releases page
- Go to Plugins → Add New → Upload Plugin
- Select the ZIP file and click "Install Now"
- Activate the plugin
Manual Installation
- Download and extract the plugin files
- Upload the
pikari-gutenberg-query-filterfolder to/wp-content/plugins/ - Activate the plugin through the WordPress admin
Via Composer
composer require pikari/gutenberg-query-filter
Usage
Basic Setup
- Create a Query Loop block in the WordPress block editor
- Add your desired filter blocks inside or near the Query Loop:
- Query Filter Block: For post types, taxonomies, and authors
- Sort Block: For sorting options
- WordPress Search Block: For search functionality (automatically detected)
Filter Block Configuration
The Query Filter block provides multiple filter types:
- Post Type Filter: Choose which post types to include in the filter
- Taxonomy Filter: Select taxonomies (categories, tags, custom taxonomies) to filter by
- Author Filter: Enable author filtering with cached author lists
Search Block Integration
Simply add a WordPress core Search block inside a Query Loop block - it will automatically:
- Detect the Query Loop context
- Use appropriate search parameters
- Reset pagination when searching
- Integrate with other filters
Sort Block
Add sort controls to allow users to sort posts by:
- Date (newest/oldest)
- Title (A-Z/Z-A)
- Custom fields (when configured)
Examples
Basic Blog with Filters
<!-- wp:query -->
<div class="wp-block-query">
<!-- wp:pikari/query-filter {"filterType":"post_type,category,author"} -->
<!-- /wp:pikari/query-filter -->
<!-- wp:pikari/sort -->
<!-- /wp:pikari/sort -->
<!-- wp:search -->
<form class="wp-block-search">
<input type="search" placeholder="Search posts..." />
</form>
<!-- /wp:search -->
<!-- wp:post-template -->
<!-- Your post template blocks here -->
<!-- /wp:post-template -->
</div>
<!-- /wp:query -->
Portfolio with Custom Post Types
<!-- wp:query {"query":{"postType":"portfolio"}} -->
<div class="wp-block-query">
<!-- wp:pikari/query-filter {"filterType":"portfolio_category,portfolio_tag"} -->
<!-- /wp:pikari/query-filter -->
<!-- wp:pikari/sort {"options":[{"label":"Latest","value":"date-desc"},{"label":"Title","value":"title-asc"}]} -->
<!-- /wp:pikari/sort -->
<!-- wp:post-template -->
<!-- Portfolio item template -->
<!-- /wp:post-template -->
</div>
<!-- /wp:query -->
Architecture
Plugin Structure
- Block Integration: Modifies core WordPress blocks to add query context support
- Query Handler: Processes URL parameters and modifies WP_Query arguments
- Helper Classes: Cached data providers for authors, taxonomies, etc.
- Interactivity API: Client-side state management and navigation
Security
- All user inputs are sanitized using WordPress functions
- POST type and taxonomy validation prevents invalid queries
- No database queries without proper validation
- Follows WordPress security best practices
Performance
- Caching: Author lists and other expensive queries are cached
- Minimal Queries: Only loads necessary data for active filters
- Client-Side Navigation: No page reloads, uses WordPress Interactivity API
- Lazy Loading: Scripts only enqueue when blocks are present
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/pikariweb/pikari-gutenberg-query-filter.git
cd pikari-gutenberg-query-filter
# Install dependencies
npm install
composer install
# Start development build with file watching
npm start
# Production build
npm run build
Available Scripts
# Development
npm start # Start development build with file watching
npm run build # Create production build
npm run plugin-zip # Create distribution ZIP file
# Code Quality
npm run lint:all # Run all linters
npm run lint:fix # Auto-fix linting issues
npm run lint:php # PHP linting only
npm run lint:js # JavaScript linting only
npm run lint:css # CSS linting only
# Testing
npm test # Run JavaScript tests
composer test # Run PHP tests
# WordPress Playground
npm run playground # Start local WordPress environment
# Translations (requires wp-env to be running)
npm run i18n:pot # Generate .pot template from source files
npm run i18n:mo # Compile all .po files to .mo
npm run i18n:json # Generate JSON files for JS translations
npm run i18n # Run all i18n steps (pot + mo + json)
Translations
Translation files live in the languages/ directory. The plugin ships with French Canadian (fr_CA) translations.
To update translations after changing translatable strings:
- Start wp-env:
npm run wp-env - Regenerate the
.pottemplate:npm run i18n:pot - Update existing
.pofiles with new strings:msgmerge --update languages/pikari-gutenberg-query-filter-fr_CA.po languages/pikari-gutenberg-query-filter.pot - Translate any new
msgidentries in the.pofile - Compile all translation files:
npm run i18n:mo && npm run i18n:json
To add a new locale, create a .po file from the .pot template using msginit:
msginit --input=languages/pikari-gutenberg-query-filter.pot \
--output-file=languages/pikari-gutenberg-query-filter-{locale}.po \
--locale={locale} --no-translator
Project Structure
pikari-gutenberg-query-filter/
├── includes/ # PHP classes
│ ├── Core/ # Core functionality
│ ├── Helpers/ # Helper classes
│ └── Integrations/ # WordPress integrations
├── src/ # Source files
│ ├── blocks/ # Block definitions
│ │ ├── query-filter/ # Main filter block
│ │ └── sort/ # Sort control block
├── build/ # Compiled assets (gitignored)
├── tests/ # Test files
└── _playground/ # WordPress Playground config
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following the coding standards in
CLAUDE.md - Run tests and linting (
npm run lint:all && npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Compatibility
WordPress
- Core Query Loop: Full support for WordPress core Query Loop blocks
- Advanced Query Loop: Compatible with Advanced Query Loop by Ryan Welcher
- Custom Queries: Supports both inherited and custom query configurations
Themes
- Block Themes: Full support for block-based themes
- Classic Themes: Works with classic themes that support blocks
- Custom CSS: Provides CSS classes for custom styling
Browsers
- Modern Browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- JavaScript: Requires JavaScript enabled for interactive features
- Progressive Enhancement: Graceful degradation when JavaScript is disabled
Troubleshooting
Search Block Not Working
- Ensure the search block is placed inside a Query Loop block
- Check that the Query Loop has a valid query configuration
- Verify JavaScript is enabled and no console errors
Filters Not Updating
- Check that filter blocks are configured with appropriate post types/taxonomies
- Ensure the Query Loop block has compatible query settings
- Review browser console for any JavaScript errors
Performance Issues
- Review the number of posts being queried (use pagination)
- Check if author caching is working properly
- Consider limiting the number of filter options
License
GPL-2.0-or-later - see LICENSE file for details.
Author
Pikari Inc.
- Website: https://pikari.io
- Email: development@pikari.io
- GitHub: https://github.com/pikariweb
Changelog
See CHANGELOG.md for detailed version history.
Support
- Documentation: See docs/ folder for detailed guides
- Issues: Report bugs on GitHub Issues
- Discussions: Join the conversation in GitHub Discussions
Read the full README on GitHub →
Releases
| Tag | Published | Asset | Downloads |
|---|---|---|---|
| v0.1.13 | Feb 5, 2026 | pikari-query-filter-v0.1.13.zip | 2 |
| v0.1.13 | Feb 5, 2026 | pikari-query-filter-v0.1.13-checksums.txt | 0 |
| v0.1.12 | Feb 5, 2026 | — | — |
| v0.1.11 | Nov 27, 2025 | checksums.txt | 1 |
| v0.1.11 | Nov 27, 2025 | pikari-query-filter.zip | 3 |
| v0.1.10 | Nov 27, 2025 | checksums.txt | 1 |
| v0.1.10 | Nov 27, 2025 | pikari-query-filter.zip | 1 |
| v0.1.9 | Sep 26, 2025 | checksums.txt | 0 |
| v0.1.9 | Sep 26, 2025 | pikari-query-filter.zip | 0 |
| v0.1.8 | Sep 25, 2025 | checksums.txt | 0 |
| v0.1.8 | Sep 25, 2025 | pikari-query-filter.zip | 0 |
| v0.1.7 | Sep 25, 2025 | checksums.txt | 0 |
| v0.1.7 | Sep 25, 2025 | pikari-query-filter.zip | 0 |
| v0.1.6 | Sep 25, 2025 | pikari-query-filter.zip | 0 |
| v0.1.6 | Sep 25, 2025 | checksums.txt | 0 |
| v0.1.5 | Sep 24, 2025 | checksums.txt | 0 |
| v0.1.5 | Sep 24, 2025 | pikari-query-filter.zip | 0 |
| v0.1.4 | Sep 23, 2025 | checksums.txt | 0 |
| v0.1.4 | Sep 23, 2025 | pikari-query-filter.zip | 0 |
| v0.1.3 | Sep 23, 2025 | pikari-query-filter.zip | 0 |
| v0.1.3 | Sep 23, 2025 | checksums.txt | 0 |
| v0.1.2 | Sep 23, 2025 | pikari-query-filter.zip | 0 |
| v0.1.2 | Sep 23, 2025 | checksums.txt | 0 |
| v0.1.1 | Sep 23, 2025 | pikari-query-filter.zip | 0 |
| v0.1.1 | Sep 23, 2025 | checksums.txt | 0 |