diff --git a/src/wp-includes/blocks/latest-posts.php b/src/wp-includes/blocks/latest-posts.php
index a43646edd7..961cf6b428 100644
--- a/src/wp-includes/blocks/latest-posts.php
+++ b/src/wp-includes/blocks/latest-posts.php
@@ -134,6 +134,10 @@ function render_block_core_latest_posts( $attributes ) {
$trimmed_excerpt = get_the_excerpt( $post );
+ if ( post_password_required( $post ) ) {
+ $trimmed_excerpt = __( 'This content is password protected.' );
+ }
+
$list_items_markup .= sprintf(
'
%1$s
',
$trimmed_excerpt
@@ -142,9 +146,16 @@ function render_block_core_latest_posts( $attributes ) {
if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
&& isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) {
+
+ $post_content = wp_kses_post( html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) ) );
+
+ if ( post_password_required( $post ) ) {
+ $post_content = __( 'This content is password protected.' );
+ }
+
$list_items_markup .= sprintf(
'%1$s
',
- wp_kses_post( html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) ) )
+ $post_content
);
}