Skip to content

Commit

Permalink
Merge pull request #200 from 10up/feature/prevent-fatal-error-on-empt…
Browse files Browse the repository at this point in the history
…y-block-categories

Prevent fatal error when filtered block categories array is null.
  • Loading branch information
jeffpaul authored May 16, 2024
2 parents a9a7c69 + dbd0f50 commit 2b8eea9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function register_blocks() {
* @return array Filtered categories.
*/
function blocks_categories( $categories ) {
if ( ! is_array( $categories ) ) {
$categories = [];
}

return array_merge(
$categories,
array(
Expand Down

0 comments on commit 2b8eea9

Please sign in to comment.