Skip to content

Events: only read the event filters from a filtered URL - #2212

Merged
raicem merged 2 commits into
productionfrom
events/facets-allowlist
Oct 21, 2026
Merged

raicem merged 2 commits into
productionfrom
events/facets-allowlist

Conversation

@raicem

@raicem raicem commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Filtered URLs on the Events site (/upcoming-events/filtered/...) now only read the four event filters: type, format, month and country. Any other key in the path is ignored.
  • Query vars are set from a fixed filter → query var map instead of passing each key through.

Test plan

  • phpunit, Events 2023 Theme suite: 43/43 passing. The new tests fail without the change.
  • phpcs: nothing new. The remaining warnings in events-query.php are already on production.
  • Local events.wordpress.test: all four filters still apply, the query-string form still redirects to the pretty URL, and keys other than the four filters no longer reach the query.

🤖 Generated with Claude Code

A filtered URL like `/upcoming-events/filtered/format/online/` was parsed
for any `key/value` pair, and every key was set as a query var on the main
request. Only the four event filters belong there: type, format, month and
country.

Other keys are now dropped when the path is read, and the query vars are
set from a fixed map of filter to query var, so nothing outside it can
reach the main query either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raicem raicem self-assigned this Oct 20, 2026
@raicem
raicem marked this pull request as ready for review October 20, 2026 07:40
The four event filters were spelled out by hand in four places. Registering
the query vars, reading the plain query-string form, and carrying the other
filters through the form now all read from `FACET_QUERY_VARS`, so adding a
filter is one edit.

Setting the query vars from a filtered URL now loops over the map instead of
the parsed facets, which is just as strict and still leaves `search` out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raicem
raicem requested a review from bor0 October 20, 2026 08:08

@bor0 bor0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Filters still work through the UI and pretty URLs, keys outside the four filters are ignored, and the new tests fail when the guards are reverted. Thanks!

@raicem
raicem merged commit 4a3d935 into production Oct 21, 2026
5 checks passed
@raicem
raicem deleted the events/facets-allowlist branch October 21, 2026 06:38
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.

2 participants