From c568871226ee029487b87c7bd0b80134e9305d2f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 17 Dec 2024 22:30:36 -0800 Subject: [PATCH] Account for $meta arg in wp_prepare_attachment_for_js not being an array --- plugins/dominant-color-images/hooks.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/dominant-color-images/hooks.php b/plugins/dominant-color-images/hooks.php index a841a6f1f..c60f1d7a4 100644 --- a/plugins/dominant-color-images/hooks.php +++ b/plugins/dominant-color-images/hooks.php @@ -251,15 +251,18 @@ function dominant_color_admin_script(): void { * * @since n.e.x.t * - * @param array|mixed $response The current response array for the attachment. - * @param WP_Post $attachment The attachment post object. - * @param array $meta The attachment metadata. - * @return array The modified response array with added dominant color and transparency information. + * @param array|mixed $response The current response array for the attachment. + * @param WP_Post $attachment The attachment post object. + * @param array|false $meta The attachment metadata. + * @return array The modified response array with added dominant color and transparency information. */ -function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, array $meta ): array { +function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, $meta ): array { if ( ! is_array( $response ) ) { $response = array(); } + if ( ! is_array( $meta ) ) { + return $response; + } $response['dominantColor'] = ''; if (