Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 90d30ca

Browse files
strategioAljullu
authored andcommitted
Fix the PHP Notice in Featured Category Block when the category is deleted (#1291)
#1290
1 parent e7ea464 commit 90d30ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/BlockTypes/FeaturedCategory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class FeaturedCategory extends AbstractDynamicBlock {
4646
public function render( $attributes = array(), $content = '' ) {
4747
$id = isset( $attributes['categoryId'] ) ? (int) $attributes['categoryId'] : 0;
4848
$category = get_term( $id, 'product_cat' );
49-
if ( ! $category ) {
49+
if ( ! $category || is_wp_error( $category ) ) {
5050
return '';
5151
}
5252
$attributes = wp_parse_args( $attributes, $this->defaults );

0 commit comments

Comments
 (0)