A
A
Andrey Boychenko2016-03-28 15:27:30
WordPress
Andrey Boychenko, 2016-03-28 15:27:30

Wordpress multisite shared database with posts, pages?

Good afternoon ! There is 1 subsite which will essentially have a different template with features for visually impaired people. How can I duplicate all the content from the main site to the subsite. Will this method work - specify the database tables of the main site in the configuration file of the subsite? And even if it works, where is the configuration? I couldn't find it, thanks!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2016-03-28
@Ka4_Piton

Won't work. You are not doing it right.
What you need to do is put up one blog, with two templates.
One template will display for people with vision problems, the second for everyone else.
To switch between templates, hang a function on template_redirect.
We look in the function if there is some kind of cookie, or if there is $_GET['swithc'], then we show another template.
But, if you are so categorically configured to use a network of sites, you can use switch_to_blog (), restore_current_blog () and so on.
The algorithm will be as follows: when adding a new post, add it to the main blog, then switch to the second one, duplicate it, and switch back.
And in the same way with all the changes - adding comments, editing posts, etc.
But, as I wrote above, this option is not only wrong, it is also more difficult to implement.

K
Ksenia Mikhailova, 2016-03-28
@arizona

As far as I know, this cannot be done by default.
What worked for me was a rough remapping of the wp_options && wp_site pages in the core at the time the multisite was loaded.

V
Vladyslav Phenychnyi, 2016-03-28
@IT-means-lucky

Wordpress Multisite works with one database by default. But the tables look like wp_1_posts, wp_2_posts, wp_3_posts and so on.
Database in wp-config.php file
Theoretically, this can be done simply by registering on the second site exactly the same connection as on the first one.
But it is worth remembering that links to posts and media files are hardcoded in the WordPress database, so if you simply connect an existing database to another, then theoretically any link from one will lead to a post or page of the source site.
On the first site in the Wordpress admin panel, Tools>Export>All Content (or just Posts)
On the second site in the Wordpress admin panel, Tools>Import>Wordpress Importer
As for new posts, there seems to be a plugin for sharing content on a multisite network

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question