I built a handy dandy importer from a tab-delimited file into wordpress.
It creates or updates records in wordpress.
The logic is as follows.
1. read in a text file, parse it into single records.
2. check to see if there is an ID in input record. if so.
a. update record in wordpress with new values.
b. otherwise, create a new record with the new values.
Works great, but I am getting duplicate result for the custom fields on Update procedure. two custom fields, price, and sku, involved.
The result I get is two custom fields for "price" and two for "sku".
the code is as follows.
As you can see in both cases, update or create new post for WP, I check to see if the update post meta works first, if not it should add a custom field with value. somehow this is NOT working properly... am I missing a step?
Any help appreciated. as I now have about 1000 records with duplicate "price" and "sku" fields with values. Critical to solve, as this updater would be used, for instance to modify records pricing, and present these modified records as NEW postings for our clients to view.