I wrote a plugin for WordPress which has a few user-configurable settings that are stored using WordPress’s suggested method. I know they are saved in the wp_options table, but that is abstracted by the WordPress options API.

Now I’m trying to add a “global override” of the settings that can be configured in the Network Admin section of a multi-site installation. I found the appropriate hooks to design my settings page, however I can’t find any info about where to save the data.

If I save it using the normal options API, then the settings get saved individually for each site. I’m looking for a place to save them globally for all sites, so the plugin can first look to see if the settings have been globally overridden by the server admin.

I can just write some code to write directly to the wp_options table of one of the sites (for example site #1) or even create my own table. I know how to do all of these things, but I don’t want to do that if there’s a preferred way to write mult-site plugins.

Thanks for any advice.

1 Answer
1

You’re looking for get_site_option(). From the Codex:

Retrieve option value based on name of option. In multisite, return network option, blog option otherwise.

Leave a Reply

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