Skip to main content

$ is not a function in WordPress

When building your own theme in WordPress, using Jquery with $ might cause issues. To fix this wrap your code in this:

(function($){

  // Use can use $ instead of jQuery in here

})(jQuery);


or

jQuery(document).ready(function($){
  //you can now use $ as your jQuery object.
  var body = $( 'body' );
});

Leave a Reply