user3366931
user3366931

Reputation: 25

Automate Wordpress Post Creation and Prevent Duplicates

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

Answers (1)

Harri Bell-Thomas
Harri Bell-Thomas

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

Related Questions