Skip to content

Allow multiple choices using checkboxes - #20

Closed
samikeijonen wants to merge 1 commit into
humanmade:mainfrom
samikeijonen:feature/multiple-choices
Closed

Allow multiple choices using checkboxes#20
samikeijonen wants to merge 1 commit into
humanmade:mainfrom
samikeijonen:feature/multiple-choices

Conversation

@samikeijonen

Copy link
Copy Markdown
Contributor

Using checkbox setting user can select multiple choices in the filter.

Closes #13.

Using checkbox setting user can select multiple choices in the filter.

Closes humanmade#13.
@hanneslsm

Copy link
Copy Markdown

Tested it and it works like a charm. Would love to see this merged. :)

Copy link
Copy Markdown
Collaborator

Thanks for this @samikeijonen, and sorry it sat open so long. Closing it because multiple-choice filtering has since shipped — it landed on main in 0ae2777 and has been in released builds since 0.3.0 (current release is v0.4.1).

How to use it

On the Taxonomy Filter block (and the Post Type Filter), in the block sidebar:

  • Display TypeSelect (Dropdown), Radio (Single Choice), or Checkbox (Multiple Choice). Pick Checkbox for multi-select.
  • Layout Directionvertical / horizontal, shown once Display Type is Radio or Checkbox.

In markup that's the displayType and layoutDirection block attributes, so it can also be set directly in a block template:

<!-- wp:query-filter/taxonomy {"taxonomy":"category","displayType":"checkbox","layoutDirection":"horizontal"} /-->

Selected terms are joined into a single query var as a comma-separated slug list (?query-12-category=news,features), and pre_get_posts_transpose_query_vars() expands it with wp_parse_list() into a tax_query using 'operator' => 'IN' — so multiple terms within one taxonomy are OR'd, while separate taxonomy filters on the same loop are AND'd together. Ticking an already-ticked box removes just that term from the list, and pagination is reset on every change.

Two related things from the same area that also shipped, in case they're useful: maxVisibleTerms + showAllLabel collapse long term lists behind a "See all" toggle, and includeTerms / excludeTerms let you curate exactly which terms appear.

Your PR is the reason this was prioritised, so thank you — the eventual implementation just took a different route through the display-type attribute rather than a dedicated multiple-choice mode. #22 is still open and wanted; I've commented separately there.


Generated by Claude Code

@roborourke roborourke closed this Sep 2, 2026
@samikeijonen

samikeijonen commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@roborourke Great that it landed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to allow multiple selected values on single filter

3 participants