I am importing a large DB from an Excel spreadsheet into a wordpress DB. I was going to do it manually by creating a new table but decided to import it into the existing wordpress framework as it will allow me to change information manually in the wordpress back end.
I was importing all 2000 rows into the wp_posts table when I realised this table doesnt have a term column. The terms are stored in other tables.
My question is… how can I import the spreadsheet into the database and keep all of the important data, especially the terms, as my site queries all information by the “term” and uses jQuery tabs to display the different terms as sub-categories.
My information looks like this:
post-title(title)—category(term)—description(content)—imageUrl—price
Note: I will create a seperate column in the wp_posts table to handle the price, or any other information I need bringing in, Im just unsure about how I can get the term information into the corresponding tables…
Thanks 🙂
Don’t insert the data directly into the table. Call the wp_insert_post() function and pass in the correct values. It will take care of all the db dependencies.
To insert the meta data, use the add_postmeta() or update_postmeta() functions.