Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Subscriptions: Stop appending the “View post … subscribe” message to post excerpts in subscription emails.
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) ) {
Expand Down Expand Up @@ -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 .= '<br/><br/>';
$excerpt .= sprintf(
// translators: %s is the permalink url to the current post.
__( "<p><a href='%s'>View post</a> to subscribe to the site's newsletter.</p>", 'jetpack' ),
get_post_permalink()
);
}

return $excerpt;
}

/**
* Gate access to posts
*
Expand Down
Loading