Mass convert MySQL data entries into custom post type?

I have a MySQL table with about 500 rows of entries each containing: title, author, series, and series number.

Would anyone know how to mass convert the data into (1 entry per post) custom post type with title becoming post title, author and series as separate custom hierarchical taxonomies, and series number as a custom meta?

Read More

I’m planning to change from a simple MySQL database management system into a site in a WP MS installation.

Related posts

Leave a Reply

2 comments

  1. You can use the following method :

    1. Export your SQL data and make a CSV
      file out of it
    2. Parse that CSV file in
      a PHP script and put the data into an array
    3. Parse the array and for each row, insert the values into WP

    You will need the following functions to insert the data into WP :

    1. wp_insert_post() to create and insert post data (title, content, etc.)
    2. wp_insert_term() to create the taxonomies terms and wp_set_post_terms() to set them for each post
    3. update_post_meta() to insert the custom field data of your posts

    I suggest before doing all that you register the custom post type and taxonomies you are going to use in WP.