Most useful jQuery snippet for WordPress Developers

July 21, 2021

If you’ve run into $ is not defined while adding your jQuery code to WordPress you’ve came to the right place.

I think WordPress is doing this to avoid conflicts with other plugins.

But for those who is tired of typing jQuery instead of $ here is a nice snippet:

(function($) {
  // Your code here with $('selectors')        
})( jQuery );

Profile picture

Written by Mihail Vasilchenko
Working with Wordpress since 00s
Say hello

geekguts © 2021