Title: Import Non-WordPress Database
Last modified: August 20, 2016

---

# Import Non-WordPress Database

 *  [danielfein](https://wordpress.org/support/users/danielfein/)
 * (@danielfein)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/import-non-wordpress-database/)
 * Hi, I am trying to import a database that is not a wordpress database. I want
   my theme to call the database as posts. this is what the database looks like:
 * CREATE TABLE `dump_music_lyrics` (
    `id` int(11) NOT NULL DEFAULT ‘0’ COMMENT‘
   Unique Identifier’, `a_name` varchar(150) NOT NULL COMMENT ‘Artist / Band Name’,`
   a_tag` varchar(1) NOT NULL COMMENT ‘Artist Tag’, `a_album` varchar(150) DEFAULT
   NULL COMMENT ‘Album Name’, `a_album_year` varchar(4) DEFAULT NULL COMMENT ‘Album
   Year’, `a_song` varchar(150) DEFAULT NULL COMMENT ‘Song Title / Track Name’, `
   a_lyrics` text COMMENT ‘Song Lyrics’ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 * How can I change anything I need to to make it work? I tried changing them all
   to like rather than “a_song” it read “post_title” and then tried importing it,
   no luck. Any idea?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Rebecca O'Brien](https://wordpress.org/support/users/rjmastey/)
 * (@rjmastey)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/import-non-wordpress-database/#post-2336250)
 * You’ll need to write a custom script that will parse what you have and turn it
   into posts.
 * So, here’s a suggestion based on how I’d do it.
    1. Insert your existing table
   into your WP database. 2. Use PHP to retrieve everything from that table 3. Use
   a while loop on the results. Insert each result as a new WP post (wp_insert_post)
   with the a_lyrics as content and a_song as title. Then insert all other fields
   as custom value (add_post_meta) 4. Delete the row you just inserted from the 
   dump_music_lyrics table – in case the script times out, you won’t need to worry
   about duplicates.
 *  Thread Starter [danielfein](https://wordpress.org/support/users/danielfein/)
 * (@danielfein)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/import-non-wordpress-database/#post-2336261)
 * Can you help me do this?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Import Non-WordPress Database’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [danielfein](https://wordpress.org/support/users/danielfein/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/import-non-wordpress-database/#post-2336261)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
