Skip to content

Instantly share code, notes, and snippets.

@jbd91
Created July 30, 2019 16:08
Show Gist options
  • Select an option

  • Save jbd91/b05fcbe58a301f4428a9957fc82e6956 to your computer and use it in GitHub Desktop.

Select an option

Save jbd91/b05fcbe58a301f4428a9957fc82e6956 to your computer and use it in GitHub Desktop.
Add Settings Page to Custom Post Type
<?php
//Example from Codex page : http://codex.wordpress.org/Function_Reference/add_submenu_page
//Add this in your functions.php file, or use it in your plugin
add_action('admin_menu', 'register_my_custom_submenu_page');
function register_my_custom_submenu_page() {
add_submenu_page( 'edit.php?post_type=book', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' );
}
function my_custom_submenu_page_callback() {
echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
echo '<h2>My Custom Submenu Page</h2>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment