We published a daily blog starting in 1998, almost before the word "blog" was invented. We had static pages set up in a folder structure, but /year/month/date/index.shtml + content here
We switched to Wordpress in November of 2008 and are now scraping the archives 1998-2008 and converting to JSON... with Title, Description, Category, Date and then we are using a PHP widget to read the JSON, convert to xml and upload using the WP RSS uploader. The problem is the RSS loader is very buggy and is failing. It keeps telling us posts are already in the database, even though the new posts have a unique date string and content string. the upload file is very small, only 3 MB, PHP has plenty of memory 120MB and upload file limit is set to 32MB
We note that if one manually adds a record to the wp_posts table from the back end, using something like PHPMyAdmin, it works fine. Since the RSS import is broken, we want to try to bulk upload old posts directly into the wp_post table, but we need to add the category also. I think this is done in the wp_term_relationships table where the object_id = the post_id in the post table.
Can anyone add more light on this? Are their more dependencies that need to be inserted into other tables? We are only interested in the post, no comments or anything else. I would also need to know what the standard if for the GUID field.
If this is a really bad idea, then given the RSS uploader in 3.6 is broken, what can we do? Is did see the CVS importer plug in and we may try that... but I wanted to know if we can do it directly in PHPMyAdmin or some other standard tool for importing directly into the database. We just need to make sure the category gets inserted.
Sure you can do it in PhpMyAdmin. PhpMyAdmin > SQL
INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`)
Your values start here.
VALUES(1, 1, '2013-11-05 03:06:30', '2013-11-05 03:06:30', 'Old blog post content', 'Post Title', '', 'publish', 'open', 'open', '', 'Post Name', '', '', '2013-11-05 03:06:30', '2013-11-05 03:06:30', '', 0, 'http://localhost:8080/wordpress/?p=1', 0, 'post', '', 1)
I would use the Mail Merge feature in MS Office to create the queries. Put all the old posts in to an excel spreadsheet. The header row of the spreadsheet should correspond to...
ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count
Then when your xls file is ready create a new document in MS Word. When you select new recipients reference the xls list that you created. Insert the merge fields into the correct place in the query... It will looks something like this:
VALUES('<ID>','<post_author>','<post_date>'.....
If you're nervous about importing the old data directly into the WordPress database, you can use CSV as an intermediary format. There are many plugins built for this. Here's one that looks like it's in active development:
http://wordpress.org/plugins/wp-ultimate-csv-importer/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With