diff --git a/projects/plugins/jetpack/changelog/fix-subscription-block-excerpt-text b/projects/plugins/jetpack/changelog/fix-subscription-block-excerpt-text new file mode 100644 index 00000000000..f389622bcd8 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-subscription-block-excerpt-text @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Subscriptions: Stop appending the “View post … subscribe” message to post excerpts in subscription emails. diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php b/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php index 43d98c75146..b192857da7f 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php @@ -153,9 +153,6 @@ function ( $allowed_meta ) { // Hide existing comments add_filter( 'get_comment', __NAMESPACE__ . '\maybe_gate_existing_comments' ); - // Gate the excerpt for a post - add_filter( 'get_the_excerpt', __NAMESPACE__ . '\jetpack_filter_excerpt_for_newsletter', 10, 2 ); - // Add a 'Newsletter' column to the Edit posts page // We only display the "Newsletter" column if we have configured the paid newsletter plan if ( defined( 'WP_ADMIN' ) && WP_ADMIN && Jetpack_Memberships::has_configured_plans_jetpack_recurring_payments( 'newsletter' ) ) { @@ -982,29 +979,6 @@ function render_email( $block_content, array $parsed_block, $rendering_context ) ); } -/** - * Filter excerpts looking for subscription data. - * - * @param string $excerpt The extrapolated excerpt string. - * @param \WP_Post $post The current post being processed (in `get_the_excerpt`). - * - * @return mixed - */ -function jetpack_filter_excerpt_for_newsletter( $excerpt, $post = null ) { - // The blogmagazine theme is overriding WP core `get_the_excerpt` filter and only passing the excerpt - // TODO: Until this is fixed, return the excerpt without gating. See https://github.com/Automattic/jetpack/pull/28102#issuecomment-1369161116 - if ( $post instanceof \WP_Post && has_block( 'jetpack/subscriptions', $post ) ) { - $excerpt .= '

'; - $excerpt .= sprintf( - // translators: %s is the permalink url to the current post. - __( "

View post to subscribe to the site's newsletter.

", 'jetpack' ), - get_post_permalink() - ); - } - - return $excerpt; -} - /** * Gate access to posts *