Using the WordPress Settings API with Network Admin pages

The other day I was googling up information about coding options pages in the network administration dashboard of a WordPress multisite installation and I noticed that some people think they cannot use the Settings API with those pages. I also noticed there was no article showing how to do it, so here it is.

Following is the documented code you need to create a network options page using the WordPress Settings API. You can also go to GitHub and download a fully functional plugin that demonstrates that code, I added a normal options page in the plugin so that you can compare the code.

If you have any remark or question just use the comment section.

Image Credits: Antonio Ruiz García

4 thoughts on “Using the WordPress Settings API with Network Admin pages

      1. Asu

        BTW, you don’t need to call apply_filters('sanitize_option_' . $option_name, $_POST[$option]);, because when calling update_site_option(), this filter will also be called.


Leave a Reply

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