From 7dddb5cf0edac419d2fb8066e5eff7d132fde70f Mon Sep 17 00:00:00 2001 From: Juanma Rodriguez Escriche Date: Tue, 8 Oct 2024 09:47:48 +0200 Subject: [PATCH 1/2] Update class.wpcom-json-api-update-post-v1-2-endpoint.php to handle null input type --- .../class.wpcom-json-api-update-post-v1-2-endpoint.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php index 7baf274254fd5..e57d038e769ef 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php @@ -955,7 +955,7 @@ public function write_post( $path, $blog_id, $post_id ) { protected function should_load_theme_functions( $post_id = null ) { if ( empty( $post_id ) ) { $input = $this->input( true ); - $type = $input['type']; + $type = $input['type'] ?? null; } else { $type = get_post_type( $post_id ); } From e87d674065807226837db1ab3f5c1d44659a6cc2 Mon Sep 17 00:00:00 2001 From: Juanma Rodriguez Escriche Date: Tue, 8 Oct 2024 09:49:46 +0200 Subject: [PATCH 2/2] changelog --- .../update-add-check-to-update-post-json-api-to-avoid-warning | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning diff --git a/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning b/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning new file mode 100644 index 0000000000000..f9153222863f2 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-add-check-to-update-post-json-api-to-avoid-warning @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +JSON Endpoints: Handle null input for update post endpoint