From 6b4ddc6cc610a494d51610b6ead8483576b13fc6 Mon Sep 17 00:00:00 2001 From: Marcin Pietrzak Date: Fri, 17 Nov 2023 09:39:17 +0100 Subject: [PATCH] Manifest error #4 https://github.com/iworks/iworks-pwa/issues/4 --- includes/iworks/pwa/class-iworks-pwa-manifest.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/iworks/pwa/class-iworks-pwa-manifest.php b/includes/iworks/pwa/class-iworks-pwa-manifest.php index 5e9895f..2c6e1cd 100644 --- a/includes/iworks/pwa/class-iworks-pwa-manifest.php +++ b/includes/iworks/pwa/class-iworks-pwa-manifest.php @@ -200,8 +200,19 @@ private function print_manifest_json() { } array_unshift( $data['icons'], $one ); } - $data['shortcuts'] = $this->get_shortcuts(); - $data['id'] = $this->get_configuration_app_id(); + /** + * Check shortcuts and use it obnly when not empty. + * + * @since 1.5.7 + */ + $shortcuts = $this->get_shortcuts(); + if ( ! empty( $shortcuts ) && is_array( $shortcuts ) ) { + $data['shortcuts'] = $shortcuts; + } + /** + * app id + */ + $data['id'] = $this->get_configuration_app_id(); header( 'Content-Type: application/json' ); echo json_encode( $data ); exit;