summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/copy-post.php')
-rw-r--r--plugins/jetpack/modules/copy-post.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/jetpack/modules/copy-post.php b/plugins/jetpack/modules/copy-post.php
index 54cfc088..f57458e1 100644
--- a/plugins/jetpack/modules/copy-post.php
+++ b/plugins/jetpack/modules/copy-post.php
@@ -200,10 +200,21 @@ class Jetpack_Copy_Post {
* @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,