Changeset 53152 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 04/12/2022 09:24:51 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r53142 r53152 956 956 * for subsequent `the_content` usage. 957 957 * 958 * @since 5.0.0 958 959 * @access private 959 *960 * @since 5.0.0961 960 * 962 961 * @param string $content The post content running through this filter. … … 1143 1142 $query['posts_per_page'] = $per_page; 1144 1143 } 1145 if ( ! empty( $block->context['query']['categoryIds'] ) ) { 1146 $term_ids = array_map( 'intval', $block->context['query']['categoryIds'] ); 1147 $term_ids = array_filter( $term_ids ); 1148 $query['category__in'] = $term_ids; 1149 } 1150 if ( ! empty( $block->context['query']['tagIds'] ) ) { 1151 $term_ids = array_map( 'intval', $block->context['query']['tagIds'] ); 1152 $term_ids = array_filter( $term_ids ); 1153 $query['tag__in'] = $term_ids; 1144 // Migrate `categoryIds` and `tagIds` to `tax_query` for backwards compatibility. 1145 if ( ! empty( $block->context['query']['categoryIds'] ) || ! empty( $block->context['query']['tagIds'] ) ) { 1146 $tax_query = array(); 1147 if ( ! empty( $block->context['query']['categoryIds'] ) ) { 1148 $tax_query[] = array( 1149 'taxonomy' => 'category', 1150 'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ), 1151 'include_children' => false, 1152 ); 1153 } 1154 if ( ! empty( $block->context['query']['tagIds'] ) ) { 1155 $tax_query[] = array( 1156 'taxonomy' => 'post_tag', 1157 'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ), 1158 'include_children' => false, 1159 ); 1160 } 1161 $query['tax_query'] = $tax_query; 1162 } 1163 if ( ! empty( $block->context['query']['taxQuery'] ) ) { 1164 $query['tax_query'] = array(); 1165 foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) { 1166 if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) { 1167 $query['tax_query'][] = array( 1168 'taxonomy' => $taxonomy, 1169 'terms' => array_filter( array_map( 'intval', $terms ) ), 1170 'include_children' => false, 1171 ); 1172 } 1173 } 1154 1174 } 1155 1175 if (
Note: See TracChangeset
for help on using the changeset viewer.