I'm writing a WordPress plugin that I'd like to do the following:
- Add a WordPress plugin admin page that contains a button
- When you click the button, it loads an array of JSON objects from a file, then creates a WordPress post for each object
I got #1 done, and I can see the array of JSON objects loading upon button click since I use console.log
. (I made the button using this tutorial - uses AJAX.)
But, how would I go about giving WordPress access to the JSON array so I can create posts using wp_insert_posts
? Is this even possible?