Skip to content

Commit

Permalink
Merge pull request #836 from greenpeace/fix/block-report-all-allowed
Browse files Browse the repository at this point in the history
Fix block report when all blocks are allowed
  • Loading branch information
lithrel authored Apr 22, 2022
2 parents d20a24e + 0aa19da commit 01fd572
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions classes/search/block/class-blockusagetable.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ private function set_allowed_blocks() {
$context = new \WP_Block_Editor_Context(
[ 'post' => (object) [ 'post_type' => $type ] ]
);
$allowed = array_merge(
$allowed,
array_values( get_allowed_block_types( $context ) )
);
$on_type = get_allowed_block_types( $context );
if ( ! is_array( $on_type ) ) {
$on_type = $on_type ? $this->blocks_registered : [];
}
$allowed = array_merge( $allowed, array_values( $on_type ) );
}

$allowed = array_unique( $allowed );
Expand Down

0 comments on commit 01fd572

Please sign in to comment.