WordPress as Backend, Laravel Front End: How to connect Routes?

The thing about WordPress, while it doesn’t have a neat routing system in principle it does same operation. It takes the URL input and matches it to a set of query variables.

The not–neat thing about it is that it uses regular expressions for these not–quite–routes and a lot of them. The total number of rules fluctuates from about a hundred minimum to thousands for a complex site (dump $wp_rewrite->rules to see).

This system is entirely possible to replace (it likely won’t be particularly clean, bordering on crazy hack from WP perspective though).

The main challenge is that you would have to spent enormous effort for feature parity, that is your router not breaking 90% of things that “just work” in WP.

If you aren’t concerned about feature parity you could very well just do a small subset of them and ignore the rest.

PS or you could just make a WP site like it’s meant to be done. That works for plenty of people. 🙂

Leave a Comment