term_exists not working in Javascript
-
I finally got my back-end to create the wheel codes from the checked taxonomies in the add custom post admin area.
Now, I want to add that tire code to the wheel_type taxonomy.
The below code ran great, until I added the if statement under //Add code to Taxonomy
Now nothing is working, but I get nothing in the error console.
I figure it must be a stupid syntax mistake – can anyone help me out?
Or am I missing something else?
jQuery('#replace').click(function(){ //get tire code and name var code = jQuery('input[name="tire_code"]').val(); var name = jQuery('input[name="tire_name"]').val(); var bname = jQuery('input[name="tire_bname"]').val(); alert(code + " + " + name + " + " + bname); //get tire brand var tirebran = jQuery('#tire_brandchecklist').find(":checked").parent('label').text(); tirebran = jQuery.trim( tirebran ); //Add code to Taxonomy if( term_exists( code, wheel_type ){ continue; } else { wp_insert_term( code, wheel_type ); } //update title var title = code + ' : ' + name + ' tires'; if(tirebran!=''){ title += ' with ' + bname + ' letters'; } jQuery('input[name="post_title"]').focus().val(title); }); //--> </script>
- The topic ‘term_exists not working in Javascript’ is closed to new replies.