Skip to content

Preserve filters when searching on events page#25

Closed
dd32 wants to merge 1 commit intoproductionfrom
fix/claude/1167-search-preserves-filters
Closed

Preserve filters when searching on events page#25
dd32 wants to merge 1 commit intoproductionfrom
fix/claude/1167-search-preserves-filters

Conversation

@dd32
Copy link
Copy Markdown
Owner

@dd32 dd32 commented Mar 12, 2026

Summary

  • The search block on the events page submitted to the default WordPress search results URL, losing any active filters and leaving the events page
  • Fixes this by using the render_block_core/search filter to:
    1. Change the search form action URL to stay on the events page (using the existing build_form_action_url() helper)
    2. Inject active filter values (event_type, format_type, month, country) as hidden inputs into the search form

How it works

  • The render_block_core/search filter modifies the core search block HTML output
  • Active filter query vars are read and added as hidden <input> elements inside the <form>
  • The form action attribute is replaced with the events page URL
  • When the user searches, the request includes both the search term and any active filters

Screenshots

Before — filter bar on events page:
Before

After — filters preserved when searching:
After

Test plan

  • Go to the events page and apply a filter (e.g. Format: Online)
  • Enter a search term and submit
  • Verify the search results still show on the events page (not the WordPress search results page)
  • Verify the filter is still active after searching
  • Search without any filters active — verify it still works and stays on the events page
  • On the home page with filters, search and verify filters are preserved

Fixes WordPress#1167

🤖 Generated with Claude Code

@dd32
Copy link
Copy Markdown
Owner Author

dd32 commented Mar 24, 2026

Those screenshots are of the wrong thing..

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dd32 dd32 force-pushed the fix/claude/1167-search-preserves-filters branch from 4166f9c to cf6bf2b Compare March 24, 2026 02:54
@dd32
Copy link
Copy Markdown
Owner Author

dd32 commented Mar 24, 2026

Filed upstream: WordPress#1674

@dd32 dd32 closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant