I have a website setup made up of with more than 3-4 WordPress setups as subdirectories of main. For example:
Site
|
---------- Site/Site1
|
---------- Site/Site2
|
---------- Site/Site3
Each have separate codebase, separate DB for itself. The Database server is one and the host directory is also one. Basically we can say these are the mirrors of same setup as subdirectories of the main site.
Now, I want to know: how can I run a Loop in the homepage of parent site “Site” which will fetch and include the posts from “Site1”, “Site2”, “Site3”?
Note:
— I can’t make it Multisite setup as the codebase is existing one and complex.
— The tables inside each DB are prefixed the same.
— For better understanding of the setup situation I have attached a image here.
In the name of bad practices, I’m going to advise that you immediately rule out these using raw SQL queries with remote databases in the same page. It would be slow, insecure, and a hassle to maintain.
That you’ve landed yourself in a predicament where a combination of hyperDB+multisite is not an option demonstrates that you face serious architectural challenges in your code. Ruling out refactoring and normalisation of your code is not an option because even if you get an appropriate answer to your question, it will still be necessary further down the line, else you’ll spend more time in support and maintenance costs than it would be to fix things.
But having said that, you asked a question. Here are potential solutions.
Keep in mind that these criteria will raise the cost and lower the scalability quite dramatically:
So here are some ways of trying it:
Problems I foresee with your setup: