I have a Javascript in the function.php file, that works well to generate a part code.
When I try to add the code to a taxonomy, I get an error saying that:
Error: term_exists is not defined
It comes from this if statement in the script:
// Add Code to taxonomy
if (term_exists(code, wheel_type)) {
alert(code);
}
else
{
wp_insert_term(code, wheel_type);
}
Can anyone tell me what I did wrong, or how to add a term to a taxonomy from with in a Javascript section?