From c073c00675b0653b0fa1e924c7d3f0d064ff9002 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Thu, 19 Jun 2025 21:30:31 +0100 Subject: [PATCH] Handle null post ID in filter graph --- php/integrations/yoast.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php/integrations/yoast.php b/php/integrations/yoast.php index 87a1cd48..7e893a6e 100644 --- a/php/integrations/yoast.php +++ b/php/integrations/yoast.php @@ -163,6 +163,11 @@ public static function filter_graph( $data, $context ): array { return $data; } + // Return early if there is no post in the context. + if ( empty( $context->post ) || empty( $context->post->ID ) ) { + return $data; + } + /** * Contains the authors from the Co-Authors Plus plugin. *