I use the Breadcrumb NavXT plugin for a WP Multisite. I activated the plugin for all sites so I can use it throughout my network.

My problem is that every time I add a new site I have to change the default settings of the plugin, but I’d like WP to use the settings I already customized for the main site because on all future sites they would be the same.

Is there a way to force WP adopting the plugin settings of the main site?

1
1

Nice Question!

But I’ll leave for the asker and for the reader the task of finding the plugin options name.

This can be used for any plugin/theme that relies in a single/serialized value in the wp_options table. If it’s not a single value, it’s another task…

In this example, I’m using WP-Pagenavi option_name.

wp-pagenavi option name

Action hook found inside the function wpmu_create_blog in the file /wp-includes/ms-functions.php.

add_action( 'wpmu_new_blog', 'wpse_70977_copy_main_site_options', 10, 6 );

function wpse_70977_copy_main_site_options( $blog_id, $user_id, $domain, $path, $site_id, $meta )
{
    $mainsite = get_option( 'pagenavi_options' );
    switch_to_blog( $blog_id );
    update_option( 'pagenavi_options', $mainsite );
    restore_current_blog();
}

This code is tested with the plugin being activated on a per site basis, and with the plugin being Network Activated.

Leave a Reply

Your email address will not be published. Required fields are marked *