Tuesday, March 7, 2017

Wordpress inside Laravel Integration

I have one system (built in Laravel 4.2) and I want to integrate it with Wordpress.

Only authenticaed users can access this blog.

I think in 2 options:

1 -> In routes.php include something like

Route::group(array('before' => 'auth')), function() {
    Route::get("wordpress", function() {
         require_once public_path() . '/blog/wp-load.php';
         exit;
    });
});

Only auth users can see blogs routes. If someone try to access without login, It will show 404 error (this code doesn't work, only one example).

2 -> Integrate Laravel with Wordpress. When create a new user in Laravel, It will create also in Wordpress. When access blog, It will automatically log user into Wordpress.



via Andre Trevas

Advertisement