-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Missing Query block functionality #24934
Comments
I think we should definitely prioritize I think |
Added |
Ideally, this would be supporting taxonomies, not categories and tags specifically. |
Is there any possible way for a plugin to extend the query block for it's own purposes? For instance, a custom fields plugin that would like to add custom field filtering functionality or advanced filtering options. Does that solution have to extend the query block JS itself and then build out the Edit/Inspector Panel interface on the plugin dev's side? Asking because I think we might see this happen quite a bit for this block. |
Hey @sc0ttkclark !
The query block could be extended like any other block with filters API: https://developer.wordpress.org/block-editor/developers/filters/block-filters/. Any extension though should be supported by the REST API. Since there are definitely some things missing and more will be found that are needed, REST API should also be changed to support more things. |
https://core.trac.wordpress.org/ticket/49983 contained a request for sorting by tags. |
Not related to the querying itself but useful for pattern/theme creation: #28532 |
Some more requirements to add to the list.
|
Any updates on where post_parent and menu_order are in the updates for the query block? |
These are exactly the two options that I currently miss the most. Note that switching to the code editor and adding |
I agree that having a tag filter would be very useful for highlighting special posts on a page (functionality that is similar that Jetpack has for Featured Content). However, it would be also very useful to have a functionality in Query block to exclude posts by tag to avoid duplicates. For instance, the page has two Query blocks:
|
I was going to add the exact same thing; it'd be very nifty to have a method of excluding a taxonomy from a query loop, to have a few 'featured' posts at the top of a template, that are then not repeated in the query loop below. |
One additional display option that would simplify a lot of code and pattens would be to have the block show the posts' featured image and title or just the featured image. In the case of attachment post type - the attachment's image. |
Coming from #44041 I would just like to add a vote for custom taxonomy terms (tax_relation??) in the Query Loop. Just to be clear, it is really useful to be able to inherit the Query Loop (for say an index page or category page) AND filter that page according to a custom taxonomy. This was possible (as a bug it seems) in version 6.01. It disappeared in 6.02. I'm hoping we get the functionality back perhaps through this workflow. It means you can do a great deal with category pages. |
Happy to open a new ticket if necessary. Seems that you cannot create a template for a custom taxonomy then use the query block on that template to display the custom posts that are associated with that tax. So.. If I have registered let's say Books (cpt) and Genre (custom tax). I then create a taxonomy-genre.html template with a query:
Then in the front-end, I click a genre link (let's say "Mystery" as an example), I'm seeing ALL books (the query is not limited the results to just the cpt and custom tax). |
👋 @bradley2083 I noticed in your Query Block that you have:
When you want to use the block in a template you should have the block to inherit from the global query, so it should be |
@ntsekouras That worked. Thank you! |
Could I merge this issue #44041 (which seems to be related), i.e. incorporating full taxonomies into the query block so that filtering is possible across categories and other terms while the query is being inherited from the main search |
+1 for the exclude functionality of categories, etc. |
+1 for exclude tags/categories/current post for the single template |
With the ongoing work on FSE (#24551) the Milestone:5 is about
Query
block. The tracking issue forQuery
block changes/enhancements is here: #24762.This issue will be an overview for identifying and adding more options/parameters in
Query
block.The goal is to identify which parameters from
WP_Query
and theREST API
can and will be supported fromQuery
block.There will be definitely some work in
REST API
to support some missing parameters and options if it makes sense and there are no blockers, like theorderby:rand
param that has performance issues . An example for needed missing support isorder by
comments (comment_count
): #22002.The below list is just the starting point for identifying the parameters to be supported and it will be finalised after discussions with everyone in the community about what parameters should eventually be supported. For now it contains items that are supported and/or make sense to me to be included. Feel free to share your thoughts and add/edit things to make this complete.
WP_Query reference: https://developer.wordpress.org/reference/classes/wp_query/
Posts API reference: https://developer.wordpress.org/rest-api/reference/posts/#list-posts
Supported from REST API
page
per_page
offset
categories
post_type
order
orderby:title
orderby:date
orderby:author
orderby:parent
orderby:modified
tags_exclude
categories_exclude
before
after
author
author_exclude
sticky
tax_relation
include
exclude
NOT Supported from REST API
orderby:comment_count
orderby:menu_order
Prioritize
tags
search
Display options
We should also provide some different display options for the Query block itself and possible children Post blocks like
PostTitle
,PostExcerpt
etc. to enable users to create a list of entities which is highly customizable. This would also allow us to have more block variations and patterns.Query block design
Issue about the design is here: #25198
The text was updated successfully, but these errors were encountered: