I'm working on plugin that creates and stores some data in database table (using global $wpdb->base_prefix). In WordPress multisite I want sub-website owners to have access only to data that they've created. What is the best way to handle this? Should I create new table for each sub-website, or add "blog_id" column to table and check it every time?

Thanks for help.

1 Answer 1


use the API, the functions of WordPress for save data and check before, it is an Multisite install; thats all. The first example is only for check, is the activated as network wide.

// if is active in network of multisite
if ( is_multisite() && isset($_GET['networkwide']) && 1 == $_GET['networkwide'] ) {
    add_site_option( 'my_settings_id', $data );
} else {
    add_option( 'my_settings_id', $data );

The follow example check for mutlisite and if the plugin active in complete network.

if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) )
    $values = get_site_option( 'my_settings_id' );
    $values = get_option( 'my_settings_id' );

Also you can check this in each blog and save the data in the tables of each blog.

*the examples was from this post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.