Skip to content

Instantly share code, notes, and snippets.

@erikccoder
Last active December 17, 2015 04:39
Show Gist options
  • Save erikccoder/5552455 to your computer and use it in GitHub Desktop.
Save erikccoder/5552455 to your computer and use it in GitHub Desktop.
wordpress add tag / sub menu / into setting menu
/*
add custom admin setting tag & content;
http://codex.wordpress.org/Administration_Menus
*/
/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );
/** Step 1. */
function my_plugin_menu() {
add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
}
/** Step 3. */
function my_plugin_options() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
echo '<div class="wrap">';
echo '<p>Here is where the form would go if I actually had options.</p>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment