The only issue was that the capability was specified incorrectly when using add_options_page()
. The capability should be manage_options
. Note the underscore, no space:
function basic_treehouse_badges_menu() {
/*
* Use the add_options_page function
* add_options_page( $page_title, $menu_title, $capability, $menu-slug, $function )
*
*/
add_options_page(
'Official Tree House Badges Plugin',
'Treehouse Badges',
'manage_options',
'wp-treehouse-badges',
'wptreehouse_badges_option_page'
);
}
add_action('admin_menu','basic_treehouse_badges_menu');
function wptreehouse_badges_option_page() {
if( !current_user_can ('manage_options')) {
wp_die('You do not have sufficient permission to acces this page.');
}
echo '<p> welcome to our plugin page </p>';
}