Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect single term filter pages to their canonical archive URLs #194

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Sep 27, 2023

Currently, all terms on the site have two URLs, the filter on the archive page and the core-provided term archive. This PR redirects requests from the archive page to the term archive when there's only one term selected.

For example, these are two URLS to the same page:

The same code renders both pages (more or less), and the filters work regardless of the page you started on, so we should pick one as primary. The URL for the core term archive is nicer, so I think that's the one to use.

To test

  • Start on home or all sites
  • Apply a single filter in the dropdown
  • The resulting URL should be nice, like /category/featured/, etc.
  • Try applying other filters, they should still work (the URL is now /archive/?…)
  • If you search then filter, it should retain the search term (ex, /category/featured/?s=restaurant)

You can manually test too, /archives/?tag%5B%5D=design should redirect to /tag/design.

@ryelle ryelle added the [Component] Backend Anything wp-admin or PHP-related label Sep 27, 2023
@ryelle ryelle self-assigned this Sep 27, 2023
@ryelle ryelle merged commit 2827055 into main Sep 28, 2023
1 check passed
@ryelle ryelle deleted the update/redirect-archives branch September 28, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Backend Anything wp-admin or PHP-related
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant