Brandy
Brandy

Reputation: 554

Laravel to Wordpress Migration

I'm looking to mirage a website which is running Laravel 5.2.x to the newest version of Wordpress.

I have created a theme to match the website the only issue I'm having now is trying to import over 1000 posts from the old database into Wordpress.

Does Wordpress have a tool or plugin to import a Laravel or Non-Wordpress database to Wordpress? My database only have a posts and category table which I would assume would be easy to bring over.

Upvotes: 1

Views: 5037

Answers (1)

Jeff
Jeff

Reputation: 25221

You'll probably have to script it out in PHP. Fire up Laravel and load the Wordpress install as well. Example how to: https://wordpress.stackexchange.com/questions/47049/what-is-the-correct-way-to-use-wordpress-functions-outside-wordpress-files

Then iterate through the Laravel posts and map the fields to wordpress:

foreach(Posts::all() as $post){
  wp_insert_post([
    'post_title' => $post->title,
    'post_date' => $post->created_at->timestamp,
    // ...
  ]);
}

You could also use this library, which creates a database connection in Laravel that allows you to use eloquent to build WordPress posts: https://github.com/corcel/corcel

Upvotes: 1

Related Questions