From 58834bc960b55fe1d96b5a5cd342b40672e85fb3 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Mon, 17 May 2021 12:13:57 +0100 Subject: [PATCH] Revert "Merge pull request #429 from cloudinary/revert-428-fix/meta-null-from-master" This reverts commit d49299e6acfcb2087ffcfde8cb69bb843b99941a, reversing changes made to 55c4b22242337f9b3f0193d9ae8445bbc2f1c510. --- 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 a1bb5b672..a372d1a1c 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|null $key The meta key to get. - * @param bool $single If single or not. + * @param int $post_id The attachment ID. + * @param string $key The meta key to get. + * @param bool $single If single or not. * * @return mixed */ - public function get_post_meta( $post_id, $key = null, $single = false ) { + public function get_post_meta( $post_id, $key = '', $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 = null, $single = false ) { $meta_data[ Sync::META_KEYS['cloudinary'] ] = array(); } - if ( null === $key ) { + if ( '' === $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 ];