Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/fields/src/actions/rename-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
! [
Expand Down
5 changes: 5 additions & 0 deletions packages/fields/src/actions/trash-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) &&
Expand Down