I am trying to use jquery autocomplete to retrieve tags from wordpress db First I set a function in wp: Then i create a js: And finally my input: But as soon as I start typing I get: Uncaught TypeError: Cannot read property ‘length’ of null and at a.(EXAMPLE PATH/anonymous function).(anonymous function).source Answer This is how I resolved it: In