File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ function useManipulateDocumentCommands() {
111111 template . type === 'wp_template'
112112 ? __ ( 'Delete template' )
113113 : __ ( 'Delete template part' ) ;
114+ const path =
115+ template . type === 'wp_template'
116+ ? '/wp_template'
117+ : '/wp_template_part/all' ;
114118 commands . push ( {
115119 name : 'core/remove-template' ,
116120 label,
@@ -119,7 +123,7 @@ function useManipulateDocumentCommands() {
119123 removeTemplate ( template ) ;
120124 // Navigate to the template list
121125 history . push ( {
122- path : '/' + template . type ,
126+ path,
123127 } ) ;
124128 close ( ) ;
125129 } ,
Original file line number Diff line number Diff line change @@ -141,11 +141,18 @@ export const removeTemplate =
141141 throw lastError ;
142142 }
143143
144+ // Depending on how the entity was retrieved it's title might be
145+ // an object or simple string.
146+ const templateTitle =
147+ typeof template . title === 'string'
148+ ? template . title
149+ : template . title ?. rendered ;
150+
144151 registry . dispatch ( noticesStore ) . createSuccessNotice (
145152 sprintf (
146153 /* translators: The template/part's name. */
147154 __ ( '"%s" deleted.' ) ,
148- decodeEntities ( template . title . rendered )
155+ decodeEntities ( templateTitle )
149156 ) ,
150157 { type : 'snackbar' , id : 'site-editor-template-deleted-success' }
151158 ) ;
You can’t perform that action at this time.
0 commit comments