Title: Importing data into Posts from another source
Last modified: August 19, 2016

---

# Importing data into Posts from another source

 *  [computergenius](https://wordpress.org/support/users/computergenius/)
 * (@computergenius)
 * [17 years ago](https://wordpress.org/support/topic/importing-data-into-posts-from-another-source/)
 * I have some data, from another source, that I would like to insert directly into
   the WordPress database. No problem about writing PHP / MySQL code to do that,
   I will write a script to do this, completely independent of WordPress.
 * However, I cannot get the Posts to appear in the correct Category. This has something
   to do with the tables term_relationships and term_taxonomy. I think(!) this is
   correct, because once I have added data into the postmeta and posts tables, then
   go to WordPress Admin and add the Category, then the Posts appear correctly.
 * Does anyone know how to do this? Or is there somewhere that I can find what term_relationships
   and term_taxonomy tables do?

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years ago](https://wordpress.org/support/topic/importing-data-into-posts-from-another-source/#post-1096335)
 * Not very knowlegeable on this but you should NOT need to directly interact with
   those tables as using [wp_insert_post](http://codex.wordpress.org/Function_Reference/wp_insert_post)
   would handle that for you.
 *  Thread Starter [computergenius](https://wordpress.org/support/users/computergenius/)
 * (@computergenius)
 * [17 years ago](https://wordpress.org/support/topic/importing-data-into-posts-from-another-source/#post-1096385)
 * Yes, that’s a possible route.
 * Although I can add stuff into a page, I would have difficulty in figuring out
   an environment to use this command. It’s sort of stand-alone… I can see how it
   should be easy to use, but can’t visualise where it would go.
 * I have been playing with Tools – Import – WordPress, as I can export WordPress,
   see what the XML file should look like, then use PHP to create an XML file from
   my import data.
 * First job tomorrow, is to see if Import WordPress will import posts without affecting
   the existing posts….
 *  Thread Starter [computergenius](https://wordpress.org/support/users/computergenius/)
 * (@computergenius)
 * [17 years ago](https://wordpress.org/support/topic/importing-data-into-posts-from-another-source/#post-1096497)
 * I checked the XML files that I had created, and then created a new XML file, 
   containing just posts that I want to import, and it works!
 * So, now all I have to do, is create an XML file, from the data in my other file,
   containing the posts that I want to import, and then use WordPress Import.
 * Excellent…

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

The topic ‘Importing data into Posts from another source’ is closed to new replies.

## Tags

 * [table](https://wordpress.org/support/topic-tag/table/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 3 replies
 * 2 participants
 * Last reply from: [computergenius](https://wordpress.org/support/users/computergenius/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/importing-data-into-posts-from-another-source/#post-1096497)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
