Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stanhook's avatar

Integration WordPress and Laravel

HI,

I have an existing WordPress site that works great. The client needed to convert a ton of old Access content over and we used Laravel for the development. I now need to get the WordPress header/footer/navigation as a wrapper around my Laravel App. That way when anything changes on the WordPress side it automatically updates on the Laravel side. Any suggestions on how to accomplish that?

Thanks, Stan

0 likes
10 replies
Tray2's avatar

That sounds like it's a shitty solution, why not just move everything to Laravel instead. I think that would be a cheaper and better solution than trying to mix a CMS with Laravel.

stanhook's avatar

Just to clarify, this is not a typical WordPress site. It has a ton of custom plugins, themes, post-types, custom functionality, uses the API for additional external content and management, etc. So, this is what I have to work with. I don't anything from WordPress other than the header, navigation and footer.

Sinnbeck's avatar

So some pages are WordPress and others are laravel?

stanhook's avatar

@sinnbeck At a really high level yes. There is an entire site developed using Wordpress like described above. Over a decade ago there was another site built (1100+ pages) that housed a ton of data using ASP/SQL. It didn't make sense to get this into WordPress so we built is using Laravel. For maintenance reasons, I need the header, navigation and footer used as a wrapper for Laravel. That way as navigation and other related updates happen the Laravel items get updated as well.

Sinnbeck's avatar

@stanhook ok so laravel will serve static pages and WordPress will handle the session part? Or the other way around. I would think an iframe, but I don't know much about WordPress

stanhook's avatar

@tisuchi Yeah, I saw those. But it seems those are for user data and posts/pages integrated into Laravel which I am not interested in. I just need the header, navigation and footer.

stanhook's avatar

@Sinnbeck Yeah, kind of. I really just want to put Laravel in a subdirectory and grab the those things from WP and use it in Laravel.

For example, there was a bunch of old static HTML pages. We placed them into a subdirectory and I can use wp-load function from WordPress that allows me to load the header, navigation and footer into those pages. Easy. I want to do the same thing with Laravel. I tried and WordPress throws a 404 error. It won't allow Laravel to run in the subdirectory.

stanhook's avatar

I got this to work by placing the app in it's own folder, adding an htaccess file there to route to the public folder. WordPress also uses function __() so I renamed it ___() in Laravel since it does not update as often as WordPress. I then used require un my master layout using @php to load the WordPress wp-load file and it worked as I needed it to. I need to get the scripts I used in Laravel to load correctly because the path is set to the root directory and not the directory I put Laravel into.

If someone has a better way , please let me know.

Please or to participate in this conversation.