-
Notifications
You must be signed in to change notification settings - Fork 3.2k
6.0 Backport to add support for custom taxonomies filtering for Query Loop (from Gutenberg) #2488
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
Changes from 1 commit
d453c19
3163816
e51fd0c
b081331
cde5c14
fef0000
c658eb8
e22f662
ceedc0a
a3d71fb
a7d1560
d7b77aa
fec3207
6fbf8e5
0af2058
a3e5009
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1132,14 +1132,14 @@ function build_query_vars_from_query_block( $block, $page ) { | |
| if ( ! empty( $block->context['query']['categoryIds'] ) ) { | ||
| $tax_query[] = array( | ||
| 'taxonomy' => 'category', | ||
| 'terms' => $block->context['query']['categoryIds'], | ||
| 'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ), | ||
| 'include_children' => false, | ||
| ); | ||
| } | ||
| if ( ! empty( $block->context['query']['tagIds'] ) ) { | ||
| $tax_query[] = array( | ||
| 'taxonomy' => 'post_tag', | ||
| 'terms' => $block->context['query']['tagIds'], | ||
| 'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ), | ||
| 'include_children' => false, | ||
| ); | ||
| } | ||
|
|
@@ -1148,13 +1148,10 @@ function build_query_vars_from_query_block( $block, $page ) { | |
| if ( ! empty( $block->context['query']['taxQuery'] ) ) { | ||
| $query['tax_query'] = array(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it will stomp on any categories and tags in the shim above if the query block has both a legacy value and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if it will be possible to have the old and new attributes, as there is the client parsing that migrates the block. So in the case of deprecated blocks, we just fill the new attribute from the old ones.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks, I gather that will come in as part of a package.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using an else if ( ! empty( $block->context['query']['taxQuery'] ) ) {Not a blocker for the backport, though. |
||
| foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) { | ||
| if ( ! empty( $terms ) ) { | ||
| $term_ids = array_map( 'intval', $terms ); | ||
| $term_ids = array_filter( $term_ids ); | ||
|
|
||
| if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) { | ||
| $query['tax_query'][] = array( | ||
| 'taxonomy' => $taxonomy, | ||
| 'terms' => $terms, | ||
| 'terms' => array_filter( array_map( 'intval', $terms ) ), | ||
| 'include_children' => false, | ||
| ); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.