I need to migrate an existing website to WordPress. This website already has a basic database containing users and posts (with a category), but it also has a high number of records so it’s not possible to do it manually.
What is the best way to import them into my WordPress database? Should I try to export the old one into a CVS file or something similar?
Unless there is a core WordPress import filter available for your CMS ( see http://codex.wordpress.org/Importing_Content ) or a plugin for a CMS not covered by core WP ( see http://wordpress.org/extend/plugins/search.php?q=import ), or a Google search for your database schema doesn’t reveal anything, you need to roll your own importer.
The best way is to write a MySQL query that will take your current data and move it into the WordPress database structure. That can be complex, but in the end, it’s the most efficient and accurate method.
But you can also try exporting from the database using phpmyadmin into CSV and then working with that file with Excel or text editors to get the content into the correct WordPress table schema and import that CSV with phpmyadmin ( see http://codex.wordpress.org/Database_Description or try a CSV import plugin http://wordpress.org/extend/plugins/search.php?q=import+CSV ). That’s obviously less MySQL intensive, if you’re not that great with queries.
Or you can try building and then importing a WXR file, WP’s special import format used for moving content between WordPress installs. Export a few posts and pages from a test WordPress site to get a sample WXR file to determine the format ( see http://codex.wordpress.org/Tools_Export_Screen ). And then take a text export of your database and “massage” it into a WXR file.
Another idea is to set up an RSS feed for your site and import that way; see http://codex.wordpress.org/Importing_Content#Importing_from_an_RSS_feed But that won’t get users or categories, only posts.
You can write a simple php script to query your database, pull out the relevant data, and then use wp_insert_post to create the posts automatically in wordpress (http://codex.wordpress.org/Function_Reference/wp_insert_post). You’ll need to have included wp-blog-header.php in your script to use wp_insert_post.
What about “simply” writing a SQL script that populates the wp_posts, wp_users,… wordpress tables with the contents of your current ones?
Not for your specific CMS but you´ll be able to find example scripts for other CMS that you could use as starting point