diff --git a/projects/plugins/jetpack/changelog/add-sharing-safeguard-post b/projects/plugins/jetpack/changelog/add-sharing-safeguard-post new file mode 100644 index 0000000000000..c8ba163b65325 --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-sharing-safeguard-post @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Sharing: Fix possible warnings related to plugin compatibility. diff --git a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php index db9a37dac1216..d726ec387adc3 100644 --- a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php +++ b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php @@ -960,7 +960,8 @@ function sharing_display( $text = '', $echo = false ) { return $text; } - if ( empty( $post ) ) { + // We require the post to not be empty and be an actual WordPress post object. If it's not - we just return. + if ( empty( $post ) || ! $post instanceof \WP_Post ) { return $text; }