From 6ef10c6a4a00187b26ba080eb54582123d96c9d8 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 21 Oct 2024 15:51:57 +0800 Subject: [PATCH] Exclude Polls from Broadcast Import --- includes/class-convertkit-broadcasts-importer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/class-convertkit-broadcasts-importer.php b/includes/class-convertkit-broadcasts-importer.php index b0326d95..8a5a684d 100644 --- a/includes/class-convertkit-broadcasts-importer.php +++ b/includes/class-convertkit-broadcasts-importer.php @@ -314,11 +314,16 @@ private function parse_broadcast_content( $broadcast_content ) { } // Remove ck-hide-in-public-posts and their contents. - // This includesthe unsubscribe section. + // This includes the unsubscribe section. foreach ( $xpath->query( '//div[contains(@class, "ck-hide-in-public-posts")]' ) as $node ) { $node->parentNode->removeChild( $node ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase } + // Remove ck-poll, as interacting with these results in an error. + foreach ( $xpath->query( '//table[contains(@class, "ck-poll")]' ) as $node ) { + $node->parentNode->removeChild( $node ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + } + // Save HTML to a string. $content = $html->saveHTML();