From f60fa362f9c97b8b465ee740ecbf9feb1f3dc4e1 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Thu, 12 Dec 2024 10:21:40 +0000 Subject: [PATCH] Check for currentPostsPage before setting modalwarning --- .../components/post-actions/set-as-posts-page.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/post-actions/set-as-posts-page.js b/packages/editor/src/components/post-actions/set-as-posts-page.js index 12edd47c68d889..1d35d3a1fe2efa 100644 --- a/packages/editor/src/components/post-actions/set-as-posts-page.js +++ b/packages/editor/src/components/post-actions/set-as-posts-page.js @@ -66,13 +66,14 @@ const SetAsPostsPageModal = ( { items, closeModal } ) => { } } - const modalWarning = isPageForPostsSet - ? sprintf( - // translators: %s: title of the current home page. - __( 'This will replace the current posts page: "%s"' ), - getItemTitle( currentPostsPage ) - ) - : __( 'This page will show the latest posts.' ); + const modalWarning = + isPageForPostsSet && currentPostsPage + ? sprintf( + // translators: %s: title of the current posts page. + __( 'This will replace the current posts page: "%s"' ), + getItemTitle( currentPostsPage ) + ) + : __( 'This page will show the latest posts.' ); const modalText = sprintf( // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message.