1

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?

GDaquila
  • 131
  • 2
  • 11
  • check the console error . – Ayatullah Rahmani May 09 '17 at 11:07
  • provide the link of website where can i check? – Ayatullah Rahmani May 09 '17 at 11:07
  • I added the errors in the browser console. – GDaquila May 09 '17 at 11:09
  • you are using deprecated `live()` function what i am able to see in your error image – Alive to die - Anant May 09 '17 at 11:10
  • Why Yoast works only without jquery-ui includes? Before of update to version 4.7, the version 4.6 was perfect. For this reason I think for a conflict. – GDaquila May 09 '17 at 11:11
  • I have also changed live() with (on). The problem not change. – GDaquila May 09 '17 at 11:11
  • "I tried for change live() with on() but the problem remains.". Presumably, the problem in your screenshot no longer remains, since that was specific to the use of the "live" method. Either that or you didn't change all the code that was necessary to change. What errors have you got now? – ADyson May 09 '17 at 11:17
  • I change all .live() in the upload-images.php but the error remains. I added a pic in the post. – GDaquila May 09 '17 at 11:41
  • clearly you didn't change the problematic one. Why don't you dig into that stack trace and find the line where the error occurs? It appears to be coming from upload_images.js – ADyson May 09 '17 at 12:41
  • Here the content of upload_images.js: https://jsfiddle.net/gLc642jq/ You can see the on() is added but the console give me ever the error. – GDaquila May 09 '17 at 12:42
  • that's unreadable. I'm not going to wade through that to find out the problem unless you format it properly. If you really have removed all the `.live()`s from it, then perhaps you've got a caching issue in your browser. Try refreshing using Ctrl+F5. If that fails, manually clear your cache. – ADyson May 09 '17 at 12:43
  • I tried also on FireFox, it not change. – GDaquila May 09 '17 at 12:52

2 Answers2

1

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.

GDaquila
  • 131
  • 2
  • 11
0

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.

Blackbam
  • 17,496
  • 26
  • 97
  • 150
  • In the /public_html/wp-includes/js/jquery/ the version of jquery.js is 1.12.4. In the http://empty.com/wp-admin/index.php, I see it's loaded https://code.jquery.com/jquery-1.11.3.js. And I not see jQuery UI loaded. – GDaquila May 09 '17 at 12:55
  • Did you try to switch of all addons except yoast? Theb enqueue only jQuery ui correctly. Does the problem still exist then? Use only the versions WordPress core provides. – Blackbam May 09 '17 at 13:02
  • Yes, it's all disabled. Only Yoast is active. I must add the wp_enqueue_script function only in wp-admin/index.php ? – GDaquila May 09 '17 at 13:10
  • You also can add it to the functions.php of your Theme or anywhere else. The "admin_enqueue_scripts" hook will take care that it is enqueued properly. Then inspect source of your admin and check if any other versions of jQuery or jQuery ui are loaded or if it loads without errors. – Blackbam May 09 '17 at 13:12
  • I tried but nothing. It have no effects. Before of update, the version 4.6 was perfect. Many people have this problem: https://github.com/Yoast/wordpress-seo/issues/7071 Someone have solved with WP Rolleback Plugin. – GDaquila May 09 '17 at 13:20
  • Well if Yoast DID actually release an incompatible or problematic version a new update will be released soon. Just use the old version of Yoast and wait until they release a fixed version. – Blackbam May 09 '17 at 13:24
  • 1
    Indeed but the problem is that the prior versions not works also. Only the very old 2.3.5 works well, without problems. I'll wait. Thanks for your help. – GDaquila May 09 '17 at 13:29