Being careful with your blocks

We’re quickly approaching the one-year anniversary of the new editor being rolled into WordPress core.

While the reviews and reactions continue to be mixed, the reality of the situation is that the market for new blocks continues to grow. And there are a ton of cool things that you can do with these blocks.

But there really needs to be a warning for people looking to install plugins with blocks on your website. You should make sure you’re careful with the blocks you add.

Removing your blocks can have adverse effects

One thing I don’t think people realize with blocks is that once you add them to your site and start using them, it’s going to be very hard to not use them anymore. Once they are gone, you content could start looking like a mess.

The problem is that while the HTML for blocks is stored in the post content in the database, the JavaScript and CSS to make it look pretty and function like you want it gets loaded on each page load. And if the plugin, with the styling, scripts and function to call those resources are no longer there. That means you end up with HTML that’s unstyled and likely not working.

It’s a lot like shortcodes back in the day (or even still today I guess). If you installed a plugin that used shortcodes (or even worse, a page builder that did this), used it a lot and then removed that plugin, your shortcodes would go as well, leaving behind text in brackets, which isn’t a great look.

So this is where a test environment might come in handy. I definitely recommend fully trying out any block you want to add there, making sure it’s exactly what you want and then installing it on your live site. And just know that if you change your mind, you might have to do a lot of work to make sure there aren’t any issues with your content.

Only get blocks that you need

Also, you really need to be careful with what blocks and how many blocks you install on your website.

Something that has really taken off since the new editor was rolled out is the propagation of block libraries. These plugins allow you to add many, many blocks to your website with just a couple of button clicks.

While this might be appealing, the reality is that you probably don’t need those types of plugins. If you just need a couple of blocks, like a social sharing block or maybe , then just seek out plugins that add those blocks by themselves instead of a library.

The thing most people probably don’t think about is that those extra blocks in the library might not be used, but the code, scripts and styles that are still loaded on every page no matter what. And that can kill your page load times.

It’s just not needed and it’s bloat that your website doesn’t need. So only select the blocks that you need to have.

Just because you can doesn’t mean you should

Finally, remember that with great power comes great responsibility. Just because you can add a boatload of blocks to your website, doesn’t necessarily mean that you should.

I’ll let Dr. Ian Malcolm take it from here.

Ian Malcolm saying "Your scientists were so preoccupied with whether or not they could, they never stopped to think if they should." in Jurassic Park

Didn’t exactly turn out the best for the Jurassic Park folks. And it could turn out disastrous for your website as well.

There are a bevy of blocks out there for you to use that do a ton of things. And there will be more of those in the future as well. But your website probably doesn’t need all of them. Actually, scratch that. Your website doesn’t need all of them.

If you have a simple website, you don’t need every stinking fancy block out there. If you don’t have a physical location, obviously you don’t need a maps block. And for the last time, your website doesn’t need a photo slider or carousel, so stop looking to add one.

Just remember that just because you might be able to add that block, doesn’t mean you should. Simple as that.

So at the end of the day, just make sure you’re careful with your blocks. Be deliberate when picking the block or blocks you want to use and don’t add more than you need. And just understand what could happen when you remove them.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.