jQuery.fn.load() is deprecated solution
How to get rid of jQuery.fn.load() deprecated notices in Wordpress manually if you can not update.

By. Jacob
Edited: 2021-02-26 14:49
Wordpress development is not always easy; if you rely on third party plugins and themes, then chances are that you will have encountered the jQuery.fn.load() is deprecated error. When investigating the message it may appear like this in the control panel:
https://example.beta/wp-content/themes/Travelo/js/theme-scripts.js: jQuery.fn.load() is deprecated
The problem happens because the load() method is deprecated, but still being used by a plugin or theme. In my case, this was the Travelo theme that had to be updated — but sometimes updating a theme or plugin still does not solve the problem.
First and foremost, if you paid money for the plugin or theme that is causing the error, then I would urge the developers to fix the problem as fast as possible. It is what they are paid for after all.
If you still want to fix the problem yourself, and if you know what you are doing, you can actually easily fix this problem by replacing the load() method with on('load', ...); a deprecated implementation might look like this:
tjq(this).load(function() {
tjq(this).closest(".middle-block").middleblock();
});
We may change this like so:
tjq(this).on('load', function() {
tjq(this).closest(".middle-block").middleblock();
});
The problem also occurs for other methods. You can use the following:
- on('event', 'selector', function() {}); instead of .live()
- on('event', 'selector', function() {}); instead of .delegate()
- on('event', function() {}); instead of .bind()
It seems you can do a drop-in replacement of live() with on(). For example:
$('.travelo-install-demo-button1').live('click', function(e) {
// ...
});
Would become:
$('.travelo-install-demo-button1').on('click', function(e) {
// ...
});
Tell us what you think: