It’s up to you.
Normally when you create and query a table you use the $wpdb->prefix
property as part of the table name. In a multisite install this prefix includes the current site ID. So if you use dbDelta()
to create a table with the name $wpdb->prefix . 'tablename'
, then — assuming the default prefix of wp_
— this table will be created as wp_2_tablename
, and wp_3_tablename
etc. This ultimately means that each site in the network gets its own copy of the table, and you query the current site’s table with $wpdb->prefix . 'tablename'
.
However, if you want a single table shared across the network, then you should create and query it with $wpdb->base_prefix
, which will be the same on all sites (wp_
, if you use the default). That way if you query it with $wpdb->base_prefix . 'tablename'
the same table will be queried regardless of which site you’re currently on.
Related Posts:
- How can I trust switch_to_blog()?
- DB connection error after copying a WordPress Multisite instance to a second location
- Add WordPress MU Network Admin via Database
- How to tell which database tables belongs to which multisite site
- what are pmxi tables? [closed]
- Shared table across network
- find a random blogid across my multisite network that has at least one post published
- WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix
- Multisite: How to store global options vs. site options?
- Uploading/Deploying a Multi Site Install
- Multisite database upgrade SSL error
- Configure WordPress to read from database only, never write
- Multiple Domains and Subdomains Using Multisite Installation
- Is it possible to fix/repair all Index, Primary Key, Unique (and all other) structure of a WordPress MS Database
- Migrating WPMS from apache to IIS7 causes Database Error
- Synchronizing Two WordPress Sites Content
- How to clone and locally run a network for testing
- Two WordPress sites sharing the same database
- Is it possible to import a wordpress backup from a single site in to a multi-site configuration?
- Split a database will improve performance?
- How to Move Local Singlesite Database to Remote Multsite Database?
- Multisite Subdomain Using More Resources Than Others?
- How to change the database prefix in multisite (WPMU) install
- Importing Multiple DB to one MU database
- Make WordPress Search for Both Main Domain and Subdomain
- Does WordPress MultiSite use separate MySql databases?
- Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb
- Is there a way to run upgrade.php for one blog?
- Within the database, where is the flag which says that a user has Super Admin rights?
- Bulk activate a theme on multisite
- Migrating Multisite – Database error, missing wp_blogs table
- How to store custom user data on the database?
- WPML tables not deleted when removing multisite subsite, need help clearing up my sql-file! [closed]
- Database Tables Lost Indexes? How to Recover?
- Installed domain-based Multisite but can’t access wp-admin (redirect loop)
- Multiple multisite instances connecting to the same database
- WordPress Multisite – can I somehow merge the tables?
- Multisite with subfolders- can’t access main site- Error establishing a database connection
- Create a database for each site created in multisite?
- Use WordPress MultiSite (WPMS) with a remote database for each created site
- Will changing the folder name two directories above a fresh wordpress installation break the site?
- WordPress Multisite blogs not working after domain swap
- Least expensive way to get table prefix in multisite installation
- 2 website 1 database… Local to online
- new multisite, old db
- Removing Mutlisite lines stop DB connection
- how to migrate wpmu from one host to the other?
- Share DB tables between two blogs on the same WP Multisite installation
- How can I create blog specific database table in multisite?
- How many databases do I need?
- Locking one blog of many in a multi user/blog WordPress installation
- WordPress Multisites or Multiple WP Single sites?
- $wpdb->update prefixes database name to table when executing query
- WP MultiSite: Can’t select database error after changing to new domain
- Combining user database tables while keeping all other data in seperate for multiple sites?
- How to make multi site with single Database?
- Update WP install to WP network & it broke the DB connection
- Sharing users across multiple sites, each on their own database
- importing data into wordpress db
- How to share User Database between Two Multisite Installations + More
- How long is “as long as possible” in wp_cache_set()?
- WPMU on MySQL limited to 1GB of space?
- Questions about MU database schema and how to list all blogs
- How does WP decide how to evaluate database integrity
- How to use the same users table on multiple wordpress sites
- A database for each category?
- Problems with WordPress multisite directories/url structures and admin access after migration
- allow multisite in the installation process
- Error establishing a database connection after moving local wordpressmultisite from one directory to another
- Will resetting my database affect other sites on my multisite WordPress install?
- WordPress Database Cleanup
- Optimal setup for Multi Domain WordPress with Woocommerce
- wordpress multisite – handle Database
- Importing Posts into New Website with Same User ID’s
- WordPress automatic Login on other page?
- How to reconnect database to existing wordpress multisite setup after changing site name
- Multi-site database upgrade claims success, but db_version not updated
- Get multisite count without php?
- Multiple domain with one database
- Problem in adding new site on WP multisite
- WordPress and SQL – Update and Insert from another table if column value doesn’t exist
- MySql Database In WordPress Multisite
- WP DB Location for “Next Post to Create” Index Value
- Error establishing a database connection – Multi-site with subsite don’t exisit [duplicate]
- Plugin data shared in Multisite
- Merging versions of wp_posts based on post_title
- WordPress multisite and one database
- WordPress Multisite platform for different city for single db
- 4th Network Site Database Errors?
- Is there a full explanation on how to share a database with two WordPress sites on same server?
- HyperDB, Multisite – on new site creation put site’s tables to specific database
- NGinx + WordPress Subdomain Multi with core in Subdirectory
- How to update_site_option for specific site within network?
- Wordrpess Subdomains (Multi-Site) without Wildcard
- How do I list multisite users for the current site only
- Multisite – Change Add user to Blog notification email
- All Multisites are working as one site
- Apply Lazy loading/Infinite scroll on array data
- WordPress shows death white screen on multisite
- get_category_link() or get_tag_link() return wrong category/tag base in wordpress multisite