Web Development. Client Satisfaction. Web Consultancy. Professional. UX. Fast. Responsive Design. Dynamic. Interactive. Innovative. Ecommerce. Wordpress plugins. Prestashop modules. You name it.

How to Create WordPress Custom Admin Page Without Plugin

How to Create WordPress Custom Admin Page Without Plugin

In this tutorial we will create a new page in wordpress admin from scratch without using any plugin. This is the better way to create a new custom page in admin because you have full control and you can add any design you want and implement any functionality you want.

Create Wordpress Custom Admin Page

First step is to open your functions.php file and scroll down to the bottom of the file. Here just add the following function.
function create_custom_page(){
  $page_title = 'My Custom Page';
  $menu_title = 'My Custom Page';
  $capability = 'read';
  $slug = 'custom_page_content';
  $callback = 'custom_page_content';
  $icon = 'dashicons-welcome-write-blog';
  $position = 100;
  add_menu_page( $page_title, $menu_title, $capability, $slug, $callback, $icon, $position );
}
add_action( 'admin_menu', 'create_custom_page' );

function custom_page_content(){
  echo '<h1>My Custom Page Title</h1>';
}
In create_custom_page() function we just create the link in the wordpress's sidebar and create the page. The second function custom_page_content() is used to show the content of the page, this is the function where you should use in order to create the content of the page. You can add any functionality you want to this page, you can create custom functions to update more easily your posts, or you can work to your own plugin.  

Leave a Reply

avatar
  Subscribe  
Notify of