diff --git a/modules/copy-post.php b/modules/copy-post.php index 54cfc0883bde..f57458e1176d 100644 --- a/modules/copy-post.php +++ b/modules/copy-post.php @@ -200,10 +200,21 @@ public function remove_post_format_template( $settings ) { * @return array Array with the results of each update action. */ protected function update_likes_sharing( $source_post, $target_post_id ) { - $likes = get_post_meta( $source_post->ID, 'switch_like_status', true ); - $sharing = get_post_meta( $source_post->ID, 'sharing_disabled', false ); - $likes_result = update_post_meta( $target_post_id, 'switch_like_status', $likes ); - $sharing_result = update_post_meta( $target_post_id, 'sharing_disabled', $sharing ); + $likes = get_post_meta( $source_post->ID, 'switch_like_status', true ); + $sharing = get_post_meta( $source_post->ID, 'sharing_disabled', true ); + + if ( '' !== $likes ) { + $likes_result = update_post_meta( $target_post_id, 'switch_like_status', $likes ); + } else { + $likes_result = null; + } + + if ( '' !== $sharing ) { + $sharing_result = update_post_meta( $target_post_id, 'sharing_disabled', $sharing ); + } else { + $sharing_result = null; + } + return array( 'likes' => $likes_result, 'sharing' => $sharing_result,