Skip to content

Filter custom post types with terms in the admin area#11225

Open
sanketio wants to merge 2 commits intoWordPress:trunkfrom
sanketio:fix/62854
Open

Filter custom post types with terms in the admin area#11225
sanketio wants to merge 2 commits intoWordPress:trunkfrom
sanketio:fix/62854

Conversation

@sanketio
Copy link

Adds taxonomy filter dropdowns to custom post type list tables in wp-admin, controlled via Screen Options. Filters are hidden by default; users opt in per-taxonomy. Enabled filters appear in a dedicated second row below the built-in date/category row. The preference is persisted per-user per-screen via user meta.

Testing instructions

  1. Register a CPT with at least two custom taxonomies (e.g. movie with actor and genre), add a few terms to each, and create some posts assigned to those terms.
  2. Navigate to Posts → Movies (or whatever the CPT slug is).
  3. Confirm the list table looks identical to a standard list table — no extra row, no new dropdowns.
  4. Open Screen Options. Confirm a new "Filters" fieldset is present listing your taxonomies.
  5. Check one taxonomy (e.g. "Actors"). Confirm a dropdown appears immediately in the second row below the built-in filters — no page reload required.
  6. Select a term from the dropdown and click Filter. Confirm the URL contains ?actor=keanu-reeves (slug, not ID) and only matching posts are shown.
  7. Check a second taxonomy. Confirm both dropdowns appear in the same second row with the Filter button at the end — not on a third line.
  8. Uncheck all taxonomy checkboxes. Confirm the second row disappears entirely.
  9. Reload the page. Confirm your checkbox preferences were remembered.
  10. With a term selected in the URL (e.g. ?actor=keanu-reeves), uncheck Actors in Screen Options. Reload that URL. Confirm the filter is silently dropped and all posts are shown (not zero results).
  11. Navigate to the front-end CPT archive. Confirm no change in front-end query behaviour.

Trac ticket: https://core.trac.wordpress.org/ticket/62854

Use of AI Tools


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sanketparmar.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@sanketio sanketio changed the title Fix/62854 Filter custom post types with terms in the admin area Mar 12, 2026
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.

1 participant