• 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)
  • Not very knowlegeable on this but you should NOT need to directly interact with those tables as using wp_insert_post would handle that for you.

    Thread Starter computergenius

    (@computergenius)

    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

    (@computergenius)

    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.