PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/seo-tools/class-jetpack-seo-posts.php +12 -2 16.2-beta → 16.3-a.5 View file →
@@ -43,9 +43,10 @@
43 43 if ( ! ( $post instanceof WP_Post ) ) {
44 44 return '';
45 45 }
46 46
47 - if ( post_password_required() || ! is_singular() ) {
47 + // Check the post being described, not the global one.
48 + if ( post_password_required( $post ) || ! is_singular() ) {
48 49 return '';
49 50 }
50 51
51 52 // Business users can overwrite the description.
@@ -58,10 +59,19 @@
58 59 if ( ! empty( $post->post_excerpt ) ) {
59 60 return $post->post_excerpt;
60 61 }
61 62
63 + // The fall-through reads raw post_content, which never passes the `the_content` paywall.
64 + $content = $post->post_content;
65 + if ( \Automattic\Jetpack\SEO\Content_Gate::is_gated( $post ) ) {
66 + $content = \Automattic\Jetpack\SEO\Content_Gate::public_teaser( $post );
67 + if ( '' === $content ) {
68 + return '';
69 + }
70 + }
71 +
62 72 // Remove content within wp:query blocks and return.
63 - return Jetpack_SEO_Utils::remove_query_blocks( $post->post_content );
73 + return Jetpack_SEO_Utils::remove_query_blocks( $content );
64 74 }
65 75
66 76 /**
67 77 * Returns post's custom meta description if it is set, and if