Last active
December 17, 2015 04:39
-
-
Save erikccoder/5552455 to your computer and use it in GitHub Desktop.
wordpress add tag / sub menu / into setting menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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