I have a website that uses Woocommerce to sell products. The store was working fine until I updated to Wordress 5.5
Now whenever I edit a product, several elements in the post editor do not work. I can’t remove a featured image, and I can’t edit a post using the "Text" tab. Also when I click to set a featured image, it opens a new tab (taking me away from the post editor) with an archaic looking featured image page.
I looked in the console, and I am receiving this error:
Uncaught TypeError: jQuery(...).live is not a function
at HTMLDocument.<anonymous> (post.php?post=28000&action=edit:1636)
at i (jquery.js?ver=1.12.4-wp:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
at Function.ready (jquery.js?ver=1.12.4-wp:2)
at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)
However, the stack trace isn’t telling me much. Here are the paths in the stack trace:
First line: https://sitename.com/wp-admin/post.php?post=28000&action=edit
Second, Third, Fourth and Fifth lines: https://sitename.com/wp-includes/js/jquery/jquery.js?ver=1.12.4-wp
So the stack trace is pointing to jquery.js in WordPress includes. This doesn’t tell me much, as my WordPress version is up to date at 5.5. I can’t seem to figure out where the issue is coming from based on the stack trace, so I don’t know where to fix this depreciated error from jQuery.
Is there anything I can do to fix this? I’ve tried using this plugin and that fixes the issue: https://wordpress.org/plugins/enable-jquery-migrate-helper/
However, this is only a temporary fix, so I don’t want to use this method.
2
Answers
I have to find everywhere .live() is used in the site files and replace with .on(). This fixes the issue!
From jQuery .live() function documentation
probably jQuery was updated alongside WordPress and the function was deprecated.