diff --git a/src/blocks/post-carousel/index.php b/src/blocks/post-carousel/index.php index dde7a4fdf6e..f878dfd19a1 100755 --- a/src/blocks/post-carousel/index.php +++ b/src/blocks/post-carousel/index.php @@ -22,7 +22,7 @@ function coblocks_render_coblocks_post_carousel_block( $attributes ) { 'order' => $attributes['order'], 'orderby' => $attributes['orderBy'], 'suppress_filters' => false, - 'post__not_in' => array( $post->ID ), + 'post__not_in' => ! is_null( $post ) ? array( $post->ID ) : array(), ); if ( isset( $attributes['categories'] ) ) { diff --git a/src/blocks/posts/index.php b/src/blocks/posts/index.php index 40a34c604d3..d83c5cc9290 100755 --- a/src/blocks/posts/index.php +++ b/src/blocks/posts/index.php @@ -22,7 +22,7 @@ function coblocks_render_coblocks_posts_block( $attributes ) { 'order' => $attributes['order'], 'orderby' => $attributes['orderBy'], 'suppress_filters' => false, - 'post__not_in' => array( $post->ID ), + 'post__not_in' => ! is_null( $post ) ? array( $post->ID ) : array(), ); if ( isset( $attributes['categories'] ) ) {