Skip to content

Commit

Permalink
Inserter: Fix title condition for media tab previews (#58993)
Browse files Browse the repository at this point in the history
Unlinked contributors: nbcsteveb.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
  • Loading branch information
3 people authored and youknowriad committed Feb 20, 2024
1 parent a4478d8 commit 8c57e5c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ export function MediaPreview( { media, onClick, category } ) {
createSuccessNotice,
]
);
const title = media.title?.rendered || media.title;

const title =
typeof media.title === 'string'
? media.title
: media.title?.rendered || __( 'no title' );

let truncatedTitle;
if ( title.length > MAXIMUM_TITLE_LENGTH ) {
const omission = '...';
Expand Down

0 comments on commit 8c57e5c

Please sign in to comment.