Filter blog posts by category and tag
Goal
Create a page that lists blog posts in an Archive Loop and lets visitors narrow results by category and tag using AJAX filters.
Prerequisites
- WordPress with published Posts
- At least two Categories and two Tags assigned to different posts
- WPEnhanced Ajax Filter Blocks installed and active
Step 1: Create the page
- Go to Pages → Add New (or edit an existing archive-style page).
- Give the page a title such as Browse Articles.
- Leave the page in the block editor.
Step 2: Add the Archive Loop
- Insert an Archive Loop block (search Archive Loop under the Ajax Filter category).
- In block settings, configure:
- Post type: Post
- Posts per page: 9 (or your preferred grid size)
- Order by: Date (newest first)
- Layout: Grid (or List)
- Note the loop Block ID or section name if shown—some themes use this when linking filters.
Step 3: Add the Filter Posts block
- Above or beside the loop, insert a Filter Posts block.
- In Filter Posts settings, confirm the block is linked to the Archive Loop on the same page (same filter group / target loop, depending on your version).
- Enable Update on change so selections apply without a separate Apply button, unless you prefer manual apply for accessibility.
Step 4: Add a Category filter item
- Inside Filter Posts, add a Filter Posts Item block.
- Configure the item:
- Filter source: Taxonomy
- Taxonomy: Category
- Control type: Checkbox (multi-select) or Select
- Label: Categories
- Optional: enable Show counts so each option displays how many posts match.
Step 5: Add a Tag filter item
- Add another Filter Posts Item inside the same Filter Posts block.
- Configure:
- Filter source: Taxonomy
- Taxonomy: Tag
- Control type: Checkbox or Select
- Label: Topics
Step 6: Enable shareable URLs (optional)
In Filter Posts or global settings, enable URL sync so selected categories and tags appear in the browser address bar. Visitors can bookmark or share filtered views.
See URL sync and shareable filters for details.
Step 7: Test on the front end
- Publish or preview the page.
- Select a category—the loop should update without a full page reload.
- Add a tag filter—the results should narrow further.
- Use Reset (if enabled) to clear all filters.
Empty options?
If a category or tag shows no options or zero counts, confirm posts are published and assigned to that term. See Empty filter options.
Customizations
- Single category only: Use a Select or Radio control instead of checkboxes.
- Hide empty terms: Enable empty-term hiding in the filter item so unused categories do not appear.
- Sort order: Change Archive Loop Order by to Title or Modified date.
What's next
- Filter products by category — Apply the same pattern to WooCommerce
- Filter sources and control types — All filter source options
- URL sync and shareable filters — Bookmarkable filter states