Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a plugin that will be installed in a multisite instance.

How do I create a single settings page that is visible at the "Network admin" level only - most of the guides i've seen relate to a standard blog level plugin. Any links to information would be useful, otherwise I'll just end up going through sitewide tags to see how it's being done there.

[Update]

Looks like sitewide_tags uses add_site_option, get_site_option and update_site_option, and these functions use wp_sitemeta. However, from what I can see, there's no support for register_setting, add_setting, etc, so you have to get and set your options manually.

share|improve this question
add comment

2 Answers

Well, I faced the same need recently, but didn't know the answer either. While not an answer to your question explicitly, an alternative is to just create the options pages under the 'main' blog's options and check if multisite is enabled.

Not the ideal way, but if (like me) you were just creating an internal plugin for your own use, it is workable. It also has the advantage that all the usual functions for admin pages are available - which they aren't yet in the global network admin page context.

share|improve this answer
add comment
up vote 5 down vote accepted

As a reference

To create network or global settings, you need to do the following

  • Add a settings page

    add_submenu_page( 'settings.php'... # cf options.php for blog level`
    
  • Add a global option

    add_site_option($key,$value)
    
  • Update a global option

    update_site_option($key,$value)
    
  • Get a site option

    get_site_option($key)
    

Global settings are saved to the sitemeta table (individual blog settings are saved to <blog_id>_options table

  • I think the Settings API functions at the blog level - so uses the options table, not sitemeta. So, you can't use option groups and the like at the network level (please comment if I've got this wrong)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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