There’s a wpmu_options
action that lets you append more HTML on the Network Settings page. If you want to add your own sub-menu/page to the Settings parent menu:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | add_action('network_admin_menu', 'add_my_netw_settings_page'); function add_my_netw_settings_page() { add_submenu_page( 'settings.php', 'Co za asy', 'Co za asy', 'manage_network_options', 'my-netw-settings', 'your_form' ); } function your_form(){ $options = get_site_option('your_plugin'); ?> <form action="<?php echo admin_url('admin-post.php?action=update_my_settings'); ?>" method="post"> <?php wp_nonce_field('your_plugin_nonce'); ?> ...fields go here... </form> <?php } |
the save handler:
1 2 3 4 5 6 7 8 9 10 | add_action('admin_post_update_my_settings', 'update_my_settings'); function update_my_settings(){ check_admin_referer('your_plugin_nonce'); if(!current_user_can('manage_network_options')) wp_die('FU'); // process your fields from $_POST here and update_site_option wp_redirect(admin_url('network/settings.php?page=my-netw-settings')); exit; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.