diff --git a/packages/fields/src/actions/rename-post.tsx b/packages/fields/src/actions/rename-post.tsx index ece201112419f9..2dcb58fd6eb526 100644 --- a/packages/fields/src/actions/rename-post.tsx +++ b/packages/fields/src/actions/rename-post.tsx @@ -35,6 +35,12 @@ const renamePost: Action< PostWithPermissions > = { if ( post.status === 'trash' ) { return false; } + + // Non-database template cannot be edited. + if ( post.type === 'wp_template' && typeof post.id === 'string' ) { + return false; + } + // Templates, template parts and patterns have special checks for renaming. if ( ! [ diff --git a/packages/fields/src/actions/trash-post.tsx b/packages/fields/src/actions/trash-post.tsx index d9f7e561306713..6fbbda11618f3b 100644 --- a/packages/fields/src/actions/trash-post.tsx +++ b/packages/fields/src/actions/trash-post.tsx @@ -31,6 +31,11 @@ const trashPost: Action< PostWithPermissions > = { return false; } + // Non-database template cannot be trashed. + if ( item.type === 'wp_template' && typeof item.id === 'string' ) { + return false; + } + return ( !! item.status && ! [ 'auto-draft', 'trash' ].includes( item.status ) &&