0

I know that this issue is common and there are many similar questions about it but still my problem is a little different I have an issue regarding the last update of WordPress. The side menu and search bar do not work except in customize mode where the browser loads the migration jquery version 3. I tried all the different solutions (loading manually jquery - WordPress plugin - edit on the theme code - add some function to load jquery with hooks and without hooks) but nothing worked. I will be grateful to hear any suggestions. Note: slide menu and search bar are parts of the Theme (not a plugin). Thank you in advance

enter image description here

4
  • If you're on WordPress 5.6 try testing with this plugin: wordpress.org/plugins/enable-jquery-migrate-helper It'd help if you provided the console errors you're seeing and the jQuery code that causes them. Jan 19 at 3:04
  • Thank you very much for the comment but unfortunately, I already tried it and it did not work, the plugin does not report anything (blank logged description) - I do not know why everything works only in customize mode Jan 19 at 11:47
  • 2
    you should not dequeue jQuery! Aside from compatibility issues, this doesn't actually improve performance. People did this on the assumption that if one site caches it, the next site won't have to fetch it, but browsers have included the domain in the cache key for a decade now, so you don't gain any benefit, you just get lots of cached copies of the same resource. I strongly advise against this
    – Tom J Nowell
    Jan 19 at 16:36
  • Also, the code in the screenshot pins you to version 3.5.1 of jQuery, instead of using the version bundled with WordPress, which will change over time.
    – Pat J
    Jan 19 at 17:16
0

I had a similar problem after updating WordPress, try adding this in functions.php :

function load_jquery() 
{ 
    wp_register_script('mainJquery', get_template_directory_uri() . '/assets/js/jQuery.js', array('jquery'), 1, true);
    wp_enqueue_script('mainJquery'); 
}
add_action('wp_enqueue_scripts', 'load_jquery');

I was only missing array('jquery'), maybe it's the same for you...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.