| @@ -57,10 +57,11 @@ | ||
| 57 | 57 | |
| 58 | 58 | $block_core_latest_posts_excerpt_length = $attributes['excerptLength']; |
| 59 | 59 | add_filter( 'excerpt_length', 'gutenberg_block_core_latest_posts_get_excerpt_length', 20 ); |
| 60 | 60 | |
| 61 | - if ( ! empty( $attributes['categories'] ) ) { | |
| 62 | - $args['category__in'] = array_column( $attributes['categories'], 'id' ); | |
| 61 | + $categories = $attributes['categories'] ?? null; | |
| 62 | + if ( ! empty( $categories ) && is_array( $categories ) ) { | |
| 63 | + $args['category__in'] = array_column( $categories, 'id' ); | |
| 63 | 64 | } |
| 64 | 65 | if ( isset( $attributes['selectedAuthor'] ) ) { |
| 65 | 66 | $args['author'] = $attributes['selectedAuthor']; |
| 66 | 67 | } |