-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Query Loop: Exclude terms support #73790
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Size Change: +205 B (+0.01%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @tehjaymo, @michiecat, @retnonindya, @franckmee, @jschramm-ta, @magnuskson, @frspp. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Oh that's nice, this'll be a welcome feature for query loop fans. I wonder if "Include/Exclude: [term]" is the right vernacular. It probably is, but is there a different simpler terminology we can use? Perhaps to start we could delete "Include": any filter that specifies a term is implied to be filtering to that term. So perhaps it's enough to keep every existing filter intact, but then only prefix "Exclude" on the omissions. Does that make sense? |
|
Flaky tests detected in f15ec39. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19964253928
|
What?
Resolves: #53485
This PR adds support to exclude specific terms. The current approach is preserving the same filter (
Filters->Taxonomies), by adding two inputs for each taxonomy, one forincludeand another forexclude. I've updated the labels toinclude: [Taxonomy]andexclude: [Taxonomy], and render them sequentially for each taxonomy (see screenshot below). This might need design feedback (@WordPress/gutenberg-design ).Combination of taxonomy filters are same as before with a logical
AND.The
taxQueryattribute supports both inclusion and exclusion of taxonomy terms. The structure looks like this:The reason for suggesting this structure is to avoid another deprecation in
Query Loopblock, where we would have to support maybe forever in the code, since it's dynamic block. Ideally it should betaxQuery: { include: {}, exclude: {} }(without testing it though for the deprecation reasons I thought).Regarding the
excludeTermsnaming instead ofexclude, I chose a more convoluted name to avoid possible conflicts with a custom taxonomy namedexclude. REST API implementation expects thetaxonomy.rest_baseto be a top level key of query.Testing Instructions
Query typetoCustom.Screenshots or screencast