Answer the question
In order to leave comments, you need to log in
Virtual Multisite on Wordpress, how to implement?
The idea is simple: there is a single site on wordpress "example.ru"
It is necessary:
1. Make it possible to add subdomains "moskva.example.ru", "spb.example.ru", "krasnodar.example.ru", etc.
2. Make it one and the same site, only change for each city: title, description and other places where the name of the city is used.
3. Need a sitemap for each subsite.
Do not:
1. Create a network.
2. Use multiple sites.
An example of how it works https://korkino.mebel-store.com/
Thanks to everyone in advance for possible ideas.
Answer the question
In order to leave comments, you need to log in
In general terms:
1. Configure the server to treat example.ru and *.example.ru as the same WP site
2. In wp-config.php, set the site URLs using constants (they take precedence over the values from the database) , and set the values of these constants dynamically on the go, depending on the requested address:
define( 'WP_HOME', $_SERVER['SERVER_NAME'] );
define( 'WP_SITEURL', $_SERVER['SERVER_NAME'] );
$data = [
'moskva' => [
'name' => 'Москва',
'term_id' => 11, // ID термина таксономии cities, которая может использоваться для группировки контента, это позволит на "подсайтах" показывать только релевантный контент
'title_suffix' => ' в Москве и области', // динамическая часть тайтла сайта / страниц
...
],
'spb' => [
...
],
...
];
$title = $title . $data[ SUBDOMAIN ]['title_suffix'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question