Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// create custom plugin settings menu
add_action('admin_menu', 'rda_create_menu');
function rda_create_menu() {
//create new top-level menu
add_menu_page('RDA Plugin Settings', 'RDA Settings', 'administrator', __FILE__, 'rda_settings_page'
//call register settings function
add_action( 'admin_init', 'register_mysettings' );
function register_mysettings() {
//register our settings
register_setting( 'rda-settings-group', 'new_option_name' );
register_setting( 'rda-settings-group', 'some_other_option' );
function rda_settings_page() {
<div class="wrap">
<form method="post" action="options.php">
<?php settings_fields( 'rda-settings-group' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">New Option Name</th>
<td><input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" /></td>
<tr valign="top">
<th scope="row">Some Other Option</th>
<td><input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" /></td>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.