$wpdb->insert Database Error Duplicate Entry Error Logging

Is there an equivalent to INSERT IGNORE in the wpdb class? As I’m fetching and inserting a twitter feed and the field in which I store the tweet ID is keyed UNIQUE, I am aware that duplicates are going to occur and do not need WordPress informing me of them in my PHP error log. (Note, I would write the query I need and $wpdb->prepare it, but for whatever reason, that throws a bunch of other errors [that I’d be happy to share though don’t consider them relevant to this question]).

1 Answer
1

To answer the question directly, there is $wpdb->update but nothing that will strictly duplicate INSERT IGNORE that I know of. If $wpdb->update, does not work I am fairly sure that you will need to write your own query and use $wpdb->query and $wpdb->prepare.

Leave a Comment