Skip to content

Commit

Permalink
Check for currentPostsPage before setting modalwarning
Browse files Browse the repository at this point in the history
  • Loading branch information
mikachan committed Dec 12, 2024
1 parent 2cfd817 commit f60fa36
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/editor/src/components/post-actions/set-as-posts-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f60fa36

Please sign in to comment.