GDaquila
GDaquila

Reputation: 131

Yoast, bbPress cause JQuery conflict

After the update of Yoast to version 4.7 it look like JQuery goes in conflict and not run. In the version 2.3.5 of Yoast, JQuery run and I see this in the page:

<script type='text/javascript' src='http://empty.com/wp-admin/load-scripts.php?c=0&amp;load%5B%5D=jquery-core,jquery-migrate,utils,plupload&amp;ver=4.7.4'></script>

In all others superior versions it not run and I see this in the page:

<script type='text/javascript' src='http://empty.com/wp-admin/load-scripts.php?c=0&amp;load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,plupload&amp;ver=4.7.4'></script>

Or:

<script type='text/javascript' src='http://empty.com/wp-admin/load-scripts.php?c=0&amp;load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplet&amp;load%5B%5D=e,plupload&amp;ver=4.7.4'></script>

When load-scripts.php call jquery-ui-core, jquery-ui-widget,jquery-ui-position etc., it not run.

In the Console there are this errors:

enter image description here

I tried for change live() with on() but the problem remains. enter image description here

Before of update to version 4.7, the version 4.6 was perfect. For this reason I think for a conflict.

Suggestions?

Upvotes: 1

Views: 272

Answers (2)

GDaquila
GDaquila

Reputation: 131

enter image description here

bbPress caused a jQuery Conflict. I have delete it, also because I haven't install it.

Verified the options on phpMyAdmin database.

Empty all caches with W3 Total Cache.

Now works all again.

Upvotes: 1

Blackbam
Blackbam

Reputation: 19376

Even though it is hard to tell the exact problem I can say you what to do in order to solve it. Yoast is a widely used Plugin and if the source was actually broken thousands of webmasters would complain and they would fix it instantly.

1) Make sure you have the most recent version of both - WordPress and Yoast installed.

2) Disable all Plugins except for Yoast - 99,9% chance that you have a conflict with a second Plugin or a badly created Theme. Most probably one of those does not enqueue jquery or jquery-ui correctly or injects a script this causes problems. Maybe jQuery or jQuery UI in Admin are loaded multiple times?

This is the only correct way to do enqueue scripts: https://developer.wordpress.org/reference/functions/wp_enqueue_script/

That means:

add_action( 'admin_enqueue_scripts', 'jquery_and_ui' );

function jquery_and_ui() {
    wp_enqueue_script( 'jquery');
    wp_enqueue_script( 'jquery-ui-core');
}

Even if Yoast started to inject jQuery UI only with the new version the root of the problem is probably somewhere else in your Theme or Plugins.

Upvotes: 0

Related Questions