Skip to content

Commit

Permalink
Merge pull request #104 from boxuk/fix/query-include-exclude/fe-rende…
Browse files Browse the repository at this point in the history
…ring

[FIX] Frontend Rendering Query
  • Loading branch information
jdamner authored Aug 19, 2024
2 parents ad05ca8 + e295086 commit 31ec7e6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/query-include-exclude/query-include-exclude.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ function () {
);
}
);

add_filter(
'query_loop_block_query_vars',
function ( array $query, \WP_Block $block ): array {
$block_query = $block->context['query'] ?? array();
if ( ! empty( $block_query['include'] ) ) {
$query['post__in'] = array_map( 'intval', $block_query['include'] );
}
return $query;
},
10,
2
);

0 comments on commit 31ec7e6

Please sign in to comment.