From bb731d77fd8824d4f66147597b8a6d55bc2384ca Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 7 Aug 2024 14:34:52 +0200 Subject: [PATCH] Fix title field --- packages/edit-site/src/components/post-fields/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/post-fields/index.js b/packages/edit-site/src/components/post-fields/index.js index dcca7d49ab708..f476b676264ed 100644 --- a/packages/edit-site/src/components/post-fields/index.js +++ b/packages/edit-site/src/components/post-fields/index.js @@ -186,6 +186,10 @@ function usePostFields( viewType ) { const addLink = [ LAYOUT_TABLE, LAYOUT_GRID ].includes( viewType ) && item.status !== 'trash'; + const renderedTitle = + typeof item.title === 'string' + ? item.title + : item.title?.rendered; const title = addLink ? ( - { decodeEntities( item.title?.rendered ) || + { decodeEntities( renderedTitle ) || __( '(no title)' ) } ) : ( - { decodeEntities( item.title?.rendered ) || + { decodeEntities( renderedTitle ) || __( '(no title)' ) } );