Hey there I am pretty confused on how to store network wide options within a WordPress multisite installation.
The usual way to store any settings in WordPress is:
add_option();
update_option();
delete_option();
However the wp_options table is created for each site within a multisite installation.
The following tables are subsite specific:
myprefix_siteid_commentmeta myprefix_siteid_comments myprefix_siteid_links myprefix_siteid_options myprefix_siteid_postmeta myprefix_siteid_posts myprefix_siteid_term_relationships myprefix_siteid_term_taxonomy myprefix_siteid_termmeta myprefix_siteid_terms
The following tables are network wide:
myprefix_blogs // multisite specific myprefix_blog_versions // multisite specific myprefix_registration_log // multisite specific myprefix_signups // multisite specific myprefix_site // multisite specific myprefix_sitemeta // multisite specific myprefix_users myprefix_usermeta
Do you see the problem? There is no adequate table for storing options for the whole network, which sucks in my opinion.
However I assume that you store network wide options in the base wp_options table (myprefix_options
). However I cannot use add_option() and update_option() and so on without using switch_to_blog(1)
before.
Is there a better possibility? If not, how can I get the base wp_options table prefix?