0

I have multiple Wordpress installations sharing a database. They are also sharing the same wp-content folder. Is it possible for the sites to also share the same plugin options? I found a method for sharing the same user table across the sites - but I don't need that functionality. I just need the ability to globally set plugin options across all sites.

If this is not possible or not practical, since the sites would have different urls, I could work around it if I could essentially take a snapshot of the plugin settings of a master installation and stick those settings into the database at installation of a new install.

What I'm building is a Wordpress install launcher, which launches brand new wordpress installations that contain a predefined set of themes, plugins, pages and settings. I've worked most of it out. Currently I can fill out a form which then unzips the customized base wordpress package and installs it, creating the page content, activating the custom theme and the plugins. So I'm at a point now where the last thing I need to build into this functionality is to set a boatload of options during the install. As an example, one option I'd like to be able to set is a standard default logo for each install. Another example is that I'd like to automatically set the google maps api key for the theme that I'm using. I hope you get the idea.

I found this helpful page in the codex: https://codex.wordpress.org/Creating_Tables_with_Plugins

So at this point I think that what I need to do is to retrieve the various options/settings that I need from the base wordpress that forms the image that all new installs should mirror, and then use code like this:

$wpdb->insert( 
    $table_name, 
    array( 
        'time' => current_time( 'mysql' ), 
        'name' => $welcome_name, 
        'text' => $welcome_text, 
    ) 
);

and the other associated code from the above codex link to insert all of that data into the new Wordpress install during the install process.

I think what I'm looking for with my question is this: Does this seem like the correct and most efficient way to do this? And secondarily: the job of retrieving all of the settings for all of the existing plugins in my base install feels like a laborious chore. Any suggestions on a method for quickly identifying and retrieving the option/setting information for a particular plugin?

  • If you would multisite, you could try to enable the plugins for the whole network. – fuxia Nov 22 '16 at 19:42
  • My client has specifically asked me not to use multisite. – WilliamAlexander Nov 22 '16 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.