From 120b759553b8bd25371e2a928de8eb8acd47ddc9 Mon Sep 17 00:00:00 2001 From: Miguel Peixe Date: Wed, 15 Jan 2025 17:41:59 -0300 Subject: [PATCH] fix(content-distribution): persist site hash (#186) --- includes/content-distribution/class-outgoing-post.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/content-distribution/class-outgoing-post.php b/includes/content-distribution/class-outgoing-post.php index 40e253ba..c66b95c0 100644 --- a/includes/content-distribution/class-outgoing-post.php +++ b/includes/content-distribution/class-outgoing-post.php @@ -68,7 +68,12 @@ public function get_post() { * @return string The network post ID. */ public function get_network_post_id() { - return md5( $this->post->ID . get_bloginfo( 'url' ) ); + $site_hash = get_option( 'newspack_network_content_distribution_hash' ); + if ( ! $site_hash ) { + $site_hash = md5( get_bloginfo( 'url' ) ); + update_option( 'newspack_network_content_distribution_hash', $site_hash ); + } + return md5( $site_hash . $this->post->ID ); } /**