This block has encountered an error and cannot be previewed!
“This block has encountered an error and cannot be previewed” in the WordPress block editor. In our case, this error appears after upgrading wordpress to 6.2.
We have noticed this error while designing a website for a client who had purchased an unstable theme without any maintenance.
It looks like a bad show when instead of the block form you see the message “This block has encountered an error and cannot be previewed”.
Why does this happen?
If you have had the same problem, then we know that you are here to find a solution, and we offer a solution based on our experience, but of course we will not write a long article.
If this surprising event happened after April 1, 2023, then it is not a surprise for us. Because after the upgrade to Worpress 6.2, we have also seen many problems in other sites with this version.
So this is caused by the incompatibility of a theme or a plugin with the latest version of WordPress.
The error “This block has encountered an error and cannot be previewed” can be prevented if you take a little care!
Sometimes some “developers” and some “markets” know what they are selling, but you don’t know what you are buying. However, what is done is done! Prevention and solutions are needed now.
When you see a recommendation to upgrade WordPress, at the same time you should see an update notification for themes and plugins, otherwise don’t upgrade WordPress.
CMS, themes and plugins must be upgraded at the same time due to compatibility. You should also check if all plugins have been tested with the latest version of WordPress.
If you see a message like this “Warning: This plugin has not been tested with your current version of WordPress”, then you have one more reason to skip the upgrade.
What would be an acceptable solution in this case?
First of all, make a backup of the website files and database. This is to avoid causing more damage.
So almost all web hosting companies offer backup/restore. Restore backup can be performed through cPanel but also Plesk.
If you have a backup created, let’s say on the 25th, you must make sure that on that date your site was working well before the message “This block has encountered an error and cannot be previewed”.
But don’t forget, when you restore a backup from a few days ago, you may lose posts after that date until today. For this reason, you must first save/export the created content.
If you are ok with these steps, then you can start restoring the previous version of your website.
Best solution. Downgrade WordPress to the previous version when your website was working fine.
- Make sure you have a backup in case something goes wrong.
- Replace WordPress files and folders such as wp-includes, wp-admin etc but be careful in this part. Replace with previous version of WordPress. If the error is caused after upgrading to WordPress 6.2, download version 6.1.1, extract and replace new WordPress files and folders.
- Make sure that you do not replace the wp-content folder and wp-config.php file, because of their importance and because it is not necessary to delete them to downgrade WP.