Skip to content

Commit

Permalink
When deleting, make sure we're not deleting a fallback template
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Dec 15, 2021
1 parent b7af15e commit 4b09790
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function delete_item_permissions_check( $request ) {
*/
public function delete_item( $request ) {
$template = gutenberg_get_block_template( $request['id'], $this->post_type );
if ( ! $template ) {
if ( ! $template || $template->id !== $request['id'] ) { // Make sure there is a template for this ID (and not just a fallback one).
return new WP_Error( 'rest_template_not_found', __( 'No templates exist with that id.', 'gutenberg' ), array( 'status' => 404 ) );
}
if ( 'custom' !== $template->source ) {
Expand Down

0 comments on commit 4b09790

Please sign in to comment.