Query Loop: Add custom taxonomies to the Filters options
What problem does this address?
Currently, you can add a Query Loop block for any post type with REST API support, but the only taxonomies you can use to filter are categories and tags, not custom taxonomies. For example, on WordCamp.org, we have "Speakers", with a custom taxonomy "Speaker Groups". When I add a Query Loop with the Speakers post type, I'd expect the Speakers Group to show up in this Filters section:
What is your proposed solution?
Rather than just hard-coding categories and tags, and turning them off if they're not supported, show all post-type supported taxonomies.
This was mentioned in https://github.com/WordPress/gutenberg/issues/24934#issuecomment-686541929, but it's not clear if anyone is still working on it.
There might be some cross over with this ticket: https://github.com/WordPress/gutenberg/issues/30706
Similar situation as the OP. A lot of our clients rely on custom taxonomies to curate content. Providing any mechanism for devs to extend would be super useful. As a dev, I'd be happy the filter proposed here https://github.com/WordPress/gutenberg/issues/36504
This is something that I've seen come up again and again on client projects.
I hadn't found this issue then but added a comment about it in this PR that would allow for developers to extend the block manually to get the desired result. https://github.com/WordPress/gutenberg/issues/36504#issuecomment-983844036
A native Support in core would of course make this even better :)
This issue came up in one of our client projects today. Specifically we were evaluating use of the Query Loop block to display a custom post type, but like many custom post types it relies on an accompanying custom taxonomy. Without the ability to filter by that taxonomy we are not able to use the block.
#36504 would enable us to address the issue, but support for filtering by any taxonomy which has been associated to the post type feels like something that should just work.
I'd also love to see this gain some traction as we're looking to add some Block Patterns to a plugin and utilizing the Query Loop block with CPT support would be necessary to have this work as we've planned. For more on that see here: https://github.com/10up/simple-podcasting/issues/84.
I am coming across the same issue with my clients' websites as well and agree that it would be really great for all the related custom taxonomies for a post type to show in the query block. I'd say the vast majority of my clients need this functionality to make full use of the Query Loop block on their websites. I agree with @fabiankaegy, and @aaroncommand and everyone on this thread that this functionality should just work by default rather than require block extensions. (Though simplifying block extensions with #36504 would be great too) Thanks for bringing this forward @ryelle 🥳
+1
Using Query Loop Block for everything is so close, and yet so far. It’s frustrating having to stop for hours/days to hand-code solutions for common, low-level features when Gutenberg and Full-Site Editing are so well advanced. Custom post types should be first-class citizens, period.
Putting my +1 on this feature as well. The Loop block is amazing - just up untill this point:) As of now, I need to hand code or use a different loop-feature plugin to accomplish this.
This was added in the Gutenberg plugin in version 12.5, so if you have Gutenberg active on your site you should see the custom taxonomy under the Filters heading. If you're not using the plugin, this feature should come out in WordPress 6.0 🙂
In Gutenberg version 13.2 the tags and categories filter in the Query Loop block stopped working. Just so you know... hope a fix will be released soon.
Hey @poof86 ! The PR that implemented custom taxonomies filtering was part of 12.5 release, so it shouldn't be about this issue. We can test/discuss in the new issue you have mentioned.