Site icon Amelt.net

WordPress:WP Lightbox 2 Uncaught TypeError: $(…).live is not a function

Amelt

Amelt

This post is also available in: 日本語 (Japanese)

When I upgraded WordPress to 5.5, I ran into the following error, so I am leaving a note as a reminder.

Uncaught TypeError: $(...).live is not a function

When I checked in the Chrome developer tools console, the file related to WP Lightbox 2 was throwing an error, so when I checked it, it seems that the old version of jQuery migrate is disabled from WordPress 5.5.

At the time of writing this article, I think the following is the way to deal with it.

Workaround Part 1.Find another Lightbox plugin

I didn't have the option to keep using the old version of jQuery migrate, so I searched for a plugin that pops up images, similar to WP Lightbox 2.

Simple Lightbox
https://wordpress.org/plugins/simple-lightbox/
It is a plugin that is simple but has the minimum functions. There was no need to edit the code of past articles.

Responsive Lightbox & Gallery
https://wordpress.org/plugins/responsive-lightbox/
It has a lot of functions and you can choose the type of animation. There was no need to edit the code of past articles.

Workaround Part 2.Deal with plugins

A plugin has been developed to temporarily deal with jQuery migrate issue. I didn't use it personally, so I don't know if it works properly, but it seems that it is being developed by an official team called "The WordPress Team".

Enable jQuery Migrate Helper
https://wordpress.org/plugins/enable-jquery-migrate-helper/

Workaround Part 3.Fix WP Lightbox 2 code

If you really want to continue using WP Lightbox 2, it seems that you can fix the code and it will work. I haven't tried it personally.
https://wordpress.org/support/topic/bug-in-wordpress-5-5/