A WordPress custom post type filter narrows public listings by their registered taxonomies or custom fields. This directory demo targets the <code>directory_listing</code> post type and offers Category and Neighbourhood choices. Select Bakeries and Harbour to see the directory results narrow by both terms.

Try this: Pick Bakeries and Harbour to narrow the directory to one place.

How this demo is configured

  • Create a filter by Category (taxonomy listing_category). Show as Checkboxes. Limit to the terms Bakeries, Bars, Cafés, Gyms, Restaurants and Trades & Services.
  • Create a filter by Neighbourhood (taxonomy listing_area). Show as Checkboxes.
Filters
Category
Category
Neighbourhood
Neighbourhood
24 listings

Bars · Northside · $$$ · 4.3★

Neon Palms

60 Elm Row

Bars · Old Town · $$$ · 4.6★

Cellar Nine

9 Cellar Lane

Gyms · Northside · $$$ · 4.5★

Iron & Oak

44 Foundry Road

Trades & Services · Northside · $$ · 4.6★

Halsted Plumbing

Unit 6, Foundry Road

How a WordPress custom post type filter works

A Filter Set can target a public custom post type and use taxonomies or custom fields registered for that content. This demo targets directory_listing and filters by listing Category and Neighbourhood.

Choose Bakeries and Harbour to narrow the directory archive by category and location.

When to filter a custom post type

Use this approach when your site stores directory entries or other content as a public post type. Register the taxonomies or custom fields on that post type, then assign values to listings so shoppers can filter them.

Set up a directory Filter Set

  1. Go to Filter Sets → Add New and select the public directory post type under Content to filter.
  2. Add one taxonomy filter for Category and another for Neighbourhood. Set each shopper-facing name and unique URL keyword.
  3. Choose Category/Attribute (taxonomy) under What are you filtering?, then select the correct taxonomy under Choose taxonomy.
  4. Under Where should filters show?, target the post type archive with Post type archive (slug).
  5. Place the Filter Set on the archive and test one category and one area.

AJAX needs the matching post container

For AJAX updates, set Product list container to the wrapper around the archive cards. Use the selector that identifies the result area your theme renders.

Add custom-field filters for values that directory posts store and shoppers need to compare.

Frequently asked questions

Which result container does the demo use for AJAX?

The directory archive uses .post-list as its Product list container.

Does the directory demo use WooCommerce products?

No. It targets the directory_listing post type and its listing taxonomies.