Add custom taxonomy using JS in post editor
Very Excited - First Post to SE!
I am creating a wordpress app that uses Javascript to call some JSON data and brings it back into the editor. All of that is working great. I can console the data and see it.
The only thing I cannot tackle is: I have a custom taxonomy named genre that I need to populate with 3 new (or possibly existing) terms from the JSON data.
I know that wp requires an array to put in the data and that works and I can see it. genArr = [item[0],item[1],item[2]] for ex.
I dont have any idea how to make the call to functions.php from the javascript file that has the data where I would call the wp_insert_term (or whatever the wordpress insert taxonomy code is)
I have spent the better part of a week trying to figure this out, and I think I need to do this - but like I said I just cannot find the solution.
JS file is working in post editor - I have a button there with onClick() event. In theme functions.php - have a function there called postGenre() that takes the JSON data and add the appropriate terms to the genre taxonomy.
I am lost on how to link the onClick() to the function in functions.php
I REALLY appreciate the help.
Topic post-editor functions custom-taxonomy Wordpress javascript
Category Web