Terms Query block proof of concept#70682
Conversation
|
Size Change: +3.63 kB (+0.19%) Total Size: 1.91 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 6f58dd0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16729948945
|
|
To avoid redundant contributions I'll be contributing to this PR directly. I'll add the following features:
Apart from these changes the rest of my code seems to be pretty much same. |
|
I've started splitting this up into smaller PRs starting with the Terms Query block: #70720. I think we can still use this draft PR to test the other functionality, as it's easier to test ideas out when all the blocks are together. |
|
Hey @mikachan, would it be possible for you to make the changes mentioned here — #70747 (comment) — in this PR as well? |
|
@sarthaknagoshe2002 Yes sure, done in 05ba6d1. |
|
This is looking great, thanks for working on it.
The one thing missing that I can see is that this block doesn't have an option to display as dropdown. |
Aljullu
left a comment
There was a problem hiding this comment.
I took a quick look at the PR and it looks very promising, thanks for working on this, @mikachan! 🙌 I tested it alongside WooCommerce and it works great, it will be very useful to display 3rd-party taxonomies.
I didn't do a full review, but a couple of things that I noticed while testing it:
- When sorting by Count, I would expect taxonomies with descendants to be sorted by the number of items including the descendants, considering that's the number that is shown by the Terms Count block. In the screenshot below, it feels a bit weird that Clothing, with 23 items is between items with 1 and 2 items.
- Some styles are not properly applied. In the editor, only the selected term has styles, in the frontend, Term Name styles don't show up.
| Editor | Frontend |
|---|---|
![]() |
![]() |
- I'm not sure if the Inner blocks use content width attribute in Term template is supposed to do something. But when testing it, I didn't see any differences.
Enregistrament.de.pantalla.a.2025-08-04.17-24-33.mp4
|
Thanks for taking a look, @Aljullu! 🙇
That's strange, I'm struggling to reproduce this. Maybe it's because this PR wasn't up to date with the latest from #70720 and #70747. I've merged these updates in now.
Good spot. When we implement the inner blocks, I'll make sure the styles come through on the front end as well.
I'm not sure if we even need this option on the Term Template block, as it's already on the Terms Query block. I see that the Post Template block doesn't have this option, which I've based the Term Template on. I think I'll remove it for now. Thanks! |
|
Thanks for updating the PR, @mikachan!
Actually I noticed that the number of products displayed in the editor and in the frontend is different:
This is what the categories look like:
I didn't investigate it in detail, but I think the endpoint returns the count using
It makes sense to me! 👍 |
Ah, I think the Term Count preview was not updating correctly in the Editor, which may be fixed with 8057c83. This is what I'm seeing:
It's worth noting that this is more related to the temporary Term Count inner block, which is subject to change (we may use block bindings rather than creating a new inner block) whilst we land #70720 and #70747. |
|
@sarthaknagoshe2002 i'd just push to the PR. If there's a problem we can always move the commits to a different PR. Thank you! |
|
I was aiming to use #70720 as the base PR for all follow-up PRs, and this draft PR was just a proof of concept of the planned implemenation. But I think I've confused things by having both PRs open 🙈 I'll tidy up the PR titles so it's less confusing. I'm working on the Term Name and Term Count inner blocks now, which I've branched off of #70720 for. I'd recommend doing the same for your work as well, but you're welcome to commit directly to this PR to test things out. |
|
I'm going to close this draft PR as the main PR I'm working on now includes the full implementation of this block and it's inner blocks, so there's no need to have a separate PR for testing the full implementation: #70720 |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |








What?
Part of #49094
WIP
This adds a new block called Terms Query, to allow for a more flexible and extensible block for displaying taxonomy terms. It also adds a couple of inner blocks, Term Name and Term Count.
This PR is just a proof of concept, as I think this functionality will be easier to work on and review if it's split up into smaller PRs. More details in #49094.
Why?
To allow for more options and flexibility when displaying terms.
How?
This block allows for inner blocks and has a wider potential for extensibility compared to the Categories/Terms List block. This PR includes four new blocks:
It also allows Term Description as an inner block.
I've tried to match the functionality as closely as possible with the Categories block for now, and then we can add more options as follow-ups. Here are some ideas I've been thinking of:
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast