How To Fix WordPress $ is not a function WordPress Error in jQuery

If you encountered this issue or error after adding a jquery script on your WordPress, it only means that you are not using the correct jQuery syntax that WordPress uses. To fix this issue, simply replace the “$” dollar sign with “jQuery” word. See example below:

Generates $ is not a function error.

$( document ).ready(function() {
$("a[href='']").attr('href', '');

To remove the error, replace $ with jQuery.

jQuery( document ).ready(function() {
jQuery("a[href='']").attr('href', '');

Leave a Comment

Your email address will not be published. Required fields are marked *