When we are writing content, it is common for us to add content and delete some of that content because we don’t like it.
So, the Block editor makes deleting a particular block or a group of blocks easy and fast.
Come on, let’s learn how to delete blocks by removing the “Testimonial” pattern that we added in the last lesson.
There are many ways to delete a block, but the easiest way is:
But sometimes, as the block editor layout gets more complicated, selecting a block and hitting the delete button will not be easy.
This complexity usually comes with the parent blocks like Group, List, Row, etc.
If parent blocks are in place, we need precision to delete a block so that other blocks or the parent block won’t get deleted accidentally.
And we will get this precision from the “Document Overview” sidebar.
First, go ahead and click on the “Document Overview” button.
Then, find the last separator block in the editor.
Click on it and then delete it using your keyboard’s “delete” button.
That’s how you can be more sure you’re deleting the correct block.
Sometimes, to save time, you might want to delete multiple blocks at the same time.
And the only way to select multiple blocks is to use the “Document Overview” sidebar.
This sidebar is turning out to be much helpful, isn’t it?
Anyway, let me quickly demonstrate how it works.
I brought back all the previously deleted pattern blocks using the undo buttons.
To achieve that, first, open up the “Document Overview” sidebar.
Next, find the four blocks we want to delete.
Then, while holding the “Shift” key on your keyboard, click on the first separator block and then click on the last separator block.
This will help you select all the blocks between the two separator blocks (image and the quote blocks ).
Now, if you try hitting the delete button on your keyboard, it doesn’t work 😀
Instead, click the “three dots” icon next to any of the selected blocks.
It will bring up the settings popup, and if you scroll all the way down inside that popup, you’ll find the “Remove Blocks” button.
Just click on the “Remove blocks” button to delete all the buttons at once.
That’s all.
That’s how simple it is to delete an individual or multiple blocks inside the Block editor.
In the next lesson, I will show you how to embed Youtube and other third-party embed videos inside the block editor.