From 435c085a66ce0ed9acc55fa546f97637dbc9c406 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 9 Jan 2025 11:42:00 +1000 Subject: [PATCH] Ratings Block: Avoid warnings when the postId context is not set. --- mu-plugins/blocks/ratings-bars/render.php | 2 +- mu-plugins/blocks/ratings-stars/render.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mu-plugins/blocks/ratings-bars/render.php b/mu-plugins/blocks/ratings-bars/render.php index 9b5f1094..46f0800f 100644 --- a/mu-plugins/blocks/ratings-bars/render.php +++ b/mu-plugins/blocks/ratings-bars/render.php @@ -1,6 +1,6 @@ context['postId']; +$current_post_id = $block->context['postId'] ?? 0; if ( ! $current_post_id ) { return; } diff --git a/mu-plugins/blocks/ratings-stars/render.php b/mu-plugins/blocks/ratings-stars/render.php index c72bff10..b77e814b 100644 --- a/mu-plugins/blocks/ratings-stars/render.php +++ b/mu-plugins/blocks/ratings-stars/render.php @@ -1,6 +1,6 @@ context['postId']; +$current_post_id = $block->context['postId'] ?? 0; if ( ! $current_post_id ) { return; }