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
Query Loop: Don't show publicly non-queryable taxonomies #59458
Conversation
Size Change: +5 B (0%) Total Size: 1.71 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: @eric-michel. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! I've left a small comment to address and after that, it would be good to land.
@ntsekouras Thanks for the review! I added |
I'd like to make one more pitch to revert this change and instead fully allow for filtering based on taxonomies with There are many applications in which I would like to have a taxonomy that does not generate archive pages but does allow me to filter posts by that taxonomy in the Query Loop. Unfortunately, unlike custom post types, the As this functions now, accomplishing what should be a relatively mundane task is onerous. In order to filter the Query Loop by a taxonomy that does not create archives for its terms, I have to:
All of this instead of simply setting |
@eric-michel Thanks for the reply. This PR just doesn't display taxonomies where |
@t-hamano I was not aware that was possible; that is definitely helpful! Thank you! I would still love for the taxonomy to be visible in the UI for ease of use, if there's any chance for a change there. More options are always better, as far as I'm concerned. |
@t-hamano I reviewed a site I have in development. Since it does not use the Gutenberg plugin, the Query block still allows me to select a taxonomy that is set to Here's what I'm seeing generated from the UI:
|
This is expected behavior and is not due to the influence of this PR. The front end builds the query via the My guess is that you can use query_loop_block_query_vars filter hook to manually add taxonomies to the query. |
Fixes #59257
What?
This PR excludes taxonomies with
publicly_queryable
set tofalse
from the Filter panel in the Query Loop block.Why?
The behavior of the Query Loop block must be consistent in the editor and front end. My understanding is that
publicly_queryable
defines whether it is queryable on the front end, and if the value isfalse
, the query results will not be displayed. Therefore, I don't think the editor should display taxonomies wherepublicly_queryable
isfalse
in the first place.How?
Display only taxonomies for which
publicly_queryable
istrue
in the Filters panel. This approach is consistent elsewhere, as noted in this comment.Testing Instructions
gutenberg.php
file. This code adds queryable and non-queryable taxonomies to Post and Page, respectively.publicly_queryable
isfalse
should not be displayed.Screenshots or screencast