Skip to content

Instantly share code, notes, and snippets.

@mzalewski
Created January 28, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzalewski/e5f07a37970aeec77899d6b75db78723 to your computer and use it in GitHub Desktop.
Save mzalewski/e5f07a37970aeec77899d6b75db78723 to your computer and use it in GitHub Desktop.
Adding a menu page
<?php
function myplugin_options_page()
{
// add top level menu page
add_menu_page(
'Options Page',
'Options Page Title',
'manage_options',
'myplugin-options',
'myplugin_render_options_page'
);
}
add_action('admin_menu', 'myplugin_options_page');
function myplugin_render_options_page() {
if (!current_user_can('manage_options')) {
return;
} ?>
<div class="wrap">
<h1><?= esc_html(get_admin_page_title()); ?></h1>
<p>Page content goes here</p>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment