Reputation: 25
For one of my plugins I need to automatically create Wordpress posts (custom post type) from Twitter tweets data (from the API). Obviously I could use wp_insert_post to do this, BUT thinking about reliability and trying to avoid duplicates etc, is there a pre-existing PHP function/class I can use?
I have especially been having a problem with duplicates - my code just goes off and creates thousands of identical posts every time I refresh the page...
Upvotes: 1
Views: 175
Reputation: 684
Yes! I've recently created a class which does just this: https://github.com/HarriBellThomas/Wordpress_PostController
You can read all the docs and usage notes in the github description. Hopefully this is what you are looking for.
Upvotes: 1