From 8b99b37ff07097c76dd3bed9a3a0f8901f5155a0 Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Tue, 18 Jul 2023 20:52:12 -0400 Subject: [PATCH] check for json_decode proper output --- block-editor-custom-alignments.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block-editor-custom-alignments.php b/block-editor-custom-alignments.php index 6f72f08..8fe7c52 100644 --- a/block-editor-custom-alignments.php +++ b/block-editor-custom-alignments.php @@ -155,7 +155,13 @@ private function block_editor_custom_alignments_theme_json(): object { return new \stdClass(); } - return json_decode( $theme_json ); + $json_theme_json = json_decode( $theme_json ); + + if ( ! $json_theme_json ) { + return new \stdClass(); + } + + return $json_theme_json; } }