Create WordPress plugin page

If you are going to create a WordPress plugin, you also want to create a WordPress admin menu for your plugin so users can get to your plugin settings to adjust them.

You can create a WordPress plugin page to tell WordPress what settings users can adjust from the dashboard.

Add WordPress plugin page

When you create a WordPress admin menu, one of the add_menu_page options is $function.

if( !function_exists("extra_post_info_menu") ) { function extra_post_info_menu(){ ...   function   = 'extra_post_info_page'; ...   add_menu_page( $page_title,                  $menu_title,                   $capability,                   $menu_slug,                   $function,                   $icon_url,                   $position ); } }

This defines the function WordPress will use when displaying your menu page for the plugin.

In this example I named mine extra_post_info_page. I can start by just setting a heading on my page.

if( !function_exists("extra_post_info_page") ) { function extra_post_info_page(){ ?>   <h1>WordPress Extra Post Info</h1> <?php } } ?>

Plugin page with basic info

The results of our code so far just displays some text on our plugin page.

extra post info admin page with just heading

Save WordPress plugin settings with a form

Now that you have a very basic WordPress plugin page created, the next step is to save WordPress plugin settings with a form so that your plugin can load those settings later.

Leave a Reply