From 828cac9fbac15bbd3eaa9133634fd8e2243c5aa0 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 11 May 2021 10:13:05 +0100 Subject: [PATCH] Revert "default meta key as string" --- php/class-media.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/php/class-media.php b/php/class-media.php index a372d1a1c..a1bb5b672 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1824,13 +1824,13 @@ public function get_transformation_from_meta( $post_id ) { /** * Get Cloudinary related Post meta. * - * @param int $post_id The attachment ID. - * @param string $key The meta key to get. - * @param bool $single If single or not. + * @param int $post_id The attachment ID. + * @param string|null $key The meta key to get. + * @param bool $single If single or not. * * @return mixed */ - public function get_post_meta( $post_id, $key = '', $single = false ) { + public function get_post_meta( $post_id, $key = null, $single = false ) { $meta_data = wp_get_attachment_metadata( $post_id, true ); if ( ! is_array( $meta_data ) ) { @@ -1840,7 +1840,7 @@ public function get_post_meta( $post_id, $key = '', $single = false ) { $meta_data[ Sync::META_KEYS['cloudinary'] ] = array(); } - if ( '' === $key ) { + if ( null === $key ) { $data = $meta_data[ Sync::META_KEYS['cloudinary'] ]; } elseif ( ! empty( $meta_data[ Sync::META_KEYS['cloudinary'] ][ $key ] ) ) { $data = $meta_data[ Sync::META_KEYS['cloudinary'] ][ $key ];