π Beaver Builder is broken in v2.0
Closed this issue Β· 15 comments
Expected behavior
The Beaver Builder plugin should work in v2.0 as well as it works in v1.0.
Current behavior
When trying to activate the Beaver Builder plugin it doesn't work, a lot of errors in the console related to jQuery. See log file for all errors. Here's a screenshot as an example:
Console error log:
cpv2.lndo.site-1687575367924.log
Steps to reproduce bug
- Install and activate Beaver Builder Lite plugin.
- Create a new page.
- Activate Beaver Builder by clicking on the its tab.
- Check console.
Context
Beaver Builder officially supports ClassicPress and works in v1.x. Any users upgrading to v2.0 will have major problems. So we need to figure out what's causing it and see if it's a bug we can fix. It also does work in WP 6.2.
This was present in PHP 7.4 and 8.1.
No errors in debug.log
.
ClassicPress version
2.0
PHP version
8.1
Can you help?
I can help test a solution
@viktorix - is there a way to contact the authors of Beaver Builder Lite? If the code they have produced is maybe looking for a ClassicPress version to load things to maintain compatibility then perhaps they need to update the plugin for ClassicPress v2.
Even if there is something we need to change it would be helpful if the plugin team can narrow it down for us from their code. Based on the detials above it looks like a JS loading / availability issue.
In version.php
changing to $wp_version = '4.9.22';
does the trick.
Beaver Builder relies on $wp_version
rather that checking for ClassicPress when enqueuing scripts, legacy libraries, polyfills.
Diff for BB 2.7.0.5
diff --git a/classes/class-fl-builder.php b/classes/class-fl-builder.php
index 067ce5b86..60b9f11fe 100644
--- a/classes/class-fl-builder.php
+++ b/classes/class-fl-builder.php
@@ -813,7 +813,7 @@ static public function register_shared_vendors() {
}
// React polyfill for older versions of WordPress.
- if ( version_compare( $wp_version, '5.2', '<=' ) ) {
+ if ( version_compare( $wp_version, '5.2', '<=' ) || function_exists( 'classicpress_version' ) ) {
// React
wp_deregister_script( 'react' );
The fix above will help on ClassicPress v2 but may break things for anyone that remains on ClassicPress v1.
The fix above will help on ClassicPress v2 but may break things for anyone that remains on ClassicPress v1.
What makes you say that?
In ClassicPress v1 we have $wp_version = 4.9
(true) and classicpress_version()
exists, so true || true === true
In ClassicPress v2 we have $wp_version = 6.2
(false) and classicpress_version()
exists, so false || true === true
So for v1 nothing changes.
Sorry, hadnt noticed the code was dequeueing later - so on that basis the logic works.
Milestones for a future release of the Beaver Builder plugin.
2.7.3 is now live on wp repo with the v2 fix in place.