Skip to content

Commit 31ec7e6

Browse files
authored
Merge pull request #104 from boxuk/fix/query-include-exclude/fe-rendering
[FIX] Frontend Rendering Query
2 parents ad05ca8 + e295086 commit 31ec7e6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/query-include-exclude/query-include-exclude.php

+13
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,16 @@ function () {
2828
);
2929
}
3030
);
31+
32+
add_filter(
33+
'query_loop_block_query_vars',
34+
function ( array $query, \WP_Block $block ): array {
35+
$block_query = $block->context['query'] ?? array();
36+
if ( ! empty( $block_query['include'] ) ) {
37+
$query['post__in'] = array_map( 'intval', $block_query['include'] );
38+
}
39+
return $query;
40+
},
41+
10,
42+
2
43+
);

0 commit comments

Comments
 (0)