Adding Settings to Network Admin
-
I’ve got this successfully working with the general options, however I’m struggling with getting this working on the network admin page.
When I go to wp-admin/network/settings.php my options aren’t shown and there’s no errors.
This is all in a class and is run on the network_admin_menu hook.
Any help will be gratefully received especially it’s before I pull all of my hair out. ??
/** * Initialize the fields used for settings. * * @since 1.0.0 */ public function init_fields() { add_settings_section( 'configurator_settings_section', // ID 'Configurator Settings', // Title array($this, 'print_configurator_section_info'), // Callback 'settings.php' // Page ); add_settings_field( 'configurator_access_key', // ID 'AWS Access Key', // Title array($this, 'configurator_access_key_callback'), // Callback 'settings.php', // Page 'configurator_settings_section' // Section ); add_settings_field( 'configurator_secret_access_key', // ID 'AWS Secret Access Key', // Title array($this, 'configurator_secret_access_key_callback'), // Callback 'settings.php', // Page 'configurator_settings_section' // Section ); register_setting( 'settings.php', // Option group 'configurator_access_key', // Option name 'esc_attr' ); register_setting( 'settings.php', // Option group 'configurator_secret_access_key', // Option name 'esc_attr' ); } /** * Print the Section text */ public function print_configurator_section_info() { print 'Enter the settings for the Configurator.'; } /** * Get the settings option array and print one of its values */ public function configurator_access_key_callback() { printf( '<input type="text" id="configurator_access_key" name="configurator_access_key" value="%s" size="50" />', esc_attr(get_site_option('configurator_access_key')) ); } /** * Get the settings option array and print one of its values */ public function configurator_secret_access_key_callback() { printf( '<input type="text" id="configurator_secret_access_key" name="configurator_secret_access_key" value="%s" size="50" />', esc_attr(get_site_option('configurator_secret_access_key')) ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding Settings to Network Admin’ is closed to new replies.