Home/ Blog/ blog/ How to prevent WordPress 6.4 breaking the editing of all Pinegrow blocks

How to prevent WordPress 6.4 breaking the editing of all Pinegrow blocks

Use this guide to keep your custom blocks editable when your sites are updated to WordPress 6.4.

Important – WordPress 6.4 will break the editing of custom blocks created with Pinegrow.

A custom block can not be loaded in the editor in WordPress 6.4.

Quick summary

  • WordPress 6.4 will break editing of all custom blocks created with Pinegrow.
  • To prevent that, install a simple WordPress plugin on every site that uses these blocks. Do this before November 7, 2023 when WordPress 6.4 is scheduled to be released.
  • Later, if and when you get a chance, re-export projects with the latest Pinegrow release.

Watch a video by Adam Lowe explaining the situation:

Why will blocks break on WordPress 6.4?

Blocks exported with Pinegrow use JavaScript library pg-blocks-controls.js to display blocks controls and process server side rendering of dynamic and hybrid blocks.

The ServerSideRenderer in this library uses lodash JavaScript library to determine if block attributes changed. Until now, lodash was a part of WordPress core and was therefore always loaded in the editor.

WordPress 6.4 does not load lodash anymore. This causes a script error in pg-blocks-controls.js and in turn, blocks fail to register with WordPress API.

This issue only affects blocks in the editor. All instances of blocks on the front-end will continue to work.

WordPress 6.4 is scheduled for release on November 7, 2023.

Thanks to @marc_io who first reported the issue we have the solution ready to go.

The solution

There are two ways to solve this issue:

  • Install a simple WordPress plugin that ensures lodash is loaded.
  • Re-export themes and plugins with the latest Pinegrow release (Pinegrow Web Editor 7.8, Pinegrow WordPress Plugin 1.0.16 or Theme Converter 2.2.). These updates will be released later this week.

In the long run, re-exporting projects is a better solution. But, it does require going through each project, exporting it, deploying it to the target site and testing if everything works.

In addition, some source projects files might not be available, or you have an expired Pinegrow license / subscription.

For such cases, the plugin is the best solution. You just need to install it on every site that uses Pinegrow blocks and you are done.

The best approach is the combination of the two:
First, install the plugin on affected sites now, and then gradually re-export projects when a need to update them comes up.

The plugin is minimal and has no negative effects on the performance of your websites.

You can install the plugin right now, no need to wait for WordPress 6.4 update.

There is no conflict between the plugin and updated projects. You can have the plugin and newly exported projects running on the same site.

Download and install the plugin

The full source code of the plugin Load Lodash for Pinegrow Blocks is available on GitHub.

Download the plugin ZIP file and upload and activate it to through WordPress dashboard in Plugins -> Add new.

Activate the installed plugin.

Installed and activated plugin.

The plugin adds lodash as a script dependency to all blocks exported with previous versions of Pinegrow. The plugin does not affect blocks created manually or with other block builders.

The plugin fixes the block editing.

Re-exporting projects with the latest Pinegrow releases

Soon to be released Pinegrow updates will generate the code that uses alternative approach for comparing attributes, without the need for lodash.

Compatibility of Pinegrow projects

The first version of Pinegrow WordPress builder was released in 2015. Since then, we did not have any situations where a WordPress update would break exported projects.

This is a testament of great care that WordPress team puts into ensuring backward compatibility, and a validation of our approach of generating clean and compliant WordPress code.

In addition, the fact that Pinegrow exports themes and plugins as standalone standard PHP/JS files is a guarantee that you will always have full access and control over your projects.

The situation is a bit different when it comes to blocks and full site editing. WordPress team is developing these features in a more fluid manner, with both the UI and API changing frequently. We will continue to do our best to ensure long term compatibility of Pinegrow projects and to quickly address any breaking changes.

Last updated on October 31, 2023 at 6:02 pm

Print this article