WordPress

How to fix error of WordPress 5.3 when after update

After upgrading to WordPress 5.3, it seems that some plugins and themes does not work.

One of the causes has changed the way of writing jQuery.

If you write “$”, you can use it as jQuery.
This is no longer possible with WordPress 5.3.

Try adding the following code to your theme’s functions.php .

If this occurs in the dashboard screen , article editing, etc when after login

add_action( 'admin_enqueue_scripts', function(){
	wp_add_inline_script( 'jquery-core', 'var $ = jQuery;' );
},0);

When it occurs in published articles

add_action( 'wp_enqueue_scripts', function(){
	wp_add_inline_script( 'jquery-core', 'var $ = jQuery;' );
},0);

If you are using PHP 5.3.0 or later, the above code is OK.

Try it.