$current_hash ] ); } $blocks = parse_blocks( $post->post_content ); $new_blocks = parse_blocks( $block_markup ); $content = serialize_blocks( array_merge( $blocks, $new_blocks ) ); $updated = wp_update_post( [ 'ID' => $post_id, 'post_content' => $content ], true ); if ( is_wp_error( $updated ) ) { return $updated; } return [ 'target' => 'post', 'status' => 'success', 'post_id' => $post_id, ]; } /** * @param int $post_id * @return string */ public static function hash( int $post_id ): string { $post = get_post( $post_id ); return md5( $post ? (string) $post->post_content : '' ); } }