Pattern directory theme: keep the curation and sort filters when searching - #781
Conversation
…ching Searching from `?curation=all` dropped the filter and only returned curated patterns. The search form now carries the current curation and sorting, like it already did for the category. The header search is left alone. See #709. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe search-block render filter now uses ChangesSearch filter preservation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Searching from the pattern directory preserves the selected category, curation, and sorting filters. No material merge risk was identified. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates the pattern directory search form to preserve active filters when searching.
Changes:
- Retains category, curation, and sorting parameters.
- Limits injection to forms targeting the site homepage.
| File | Summary |
|---|---|
public_html/wp-content/themes/wporg-pattern-directory-2024/inc/block-config.php |
Preserves active filters in pattern searches. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
bor0
left a comment
There was a problem hiding this comment.
LGTM. Checked a few things:
- Checking the form action also fixes another bug. On production,
/patterns/categories/header/?curation=all&orderby=date&order=asccurrently addspattern-categories=headerto the global header search too (the one that submits towordpress.org/search/do-search.php). This PR skips that form. - The action check matches production: the patterns search form's action is
https://wordpress.org/patterns/, which is the same ashome_url()once the trailing slash is removed. - The added query vars are the same ones
inject_other_filters()carries.redirect_term_archives()already keepscuration/order/orderbywhen it redirects to a category archive, so they aren't lost there.
Optional nit: the header search is only skipped because swap_header_search_action (wporg-mu-plugins, same hook, priority 10) runs first, since mu-plugins load before the theme. If that order changed, the header form would still have action="home_url('/')" when this filter runs. A short comment, or also skipping blocks with a formAction attribute, would make it safe either way.
The global header search was only skipped because the mu-plugin swaps its action before this filter runs. Checking `formAction` keeps it skipped whatever order the filters run in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks for checking, @bor0. Good catch on the filter order. 484d340 skips any search block with a |
Searching resets the Curated/All filter, so a search from
?curation=allonly returns curated patterns. The search form now keeps the curation and sorting, like it already does for the category.See #709 (comment)
Fixes #709
Testing
?s=404&curation=allinstead of?s=404, so thecurationparameter isn't dropped. The filter still says All, and results show up.🤖 Generated with Claude Code
Summary by CodeRabbit