Boopathi Rajan
Boopathi Rajan

Reputation: 1210

How to create new page in wordpress plugin?

I want to create a new page in my plugin named as custompage

I dont want to add page in Main Menu list..

If it's possible???

Upvotes: 2

Views: 7685

Answers (2)

user3319064
user3319064

Reputation:

try this

add_action( 'admin_menu', 'register_newpage' );

function register_newpage(){
    add_menu_page('custom_page', 'custom', 'administrator','custom', 'custompage');
    remove_menu_page('custom');
}

Upvotes: 3

Arka
Arka

Reputation: 591

Add following code in your plugin .

add_action( 'admin_menu', 'register_newpage' );

function register_newpage(){
    add_menu_page( 'newpage title', '', 'manage_options', 'myplugin/newpage.php', '', plugins_url( 'myplugin/images/icon.png' ), 6 );
}

keep newpage.php in your plugin folder.

Upvotes: 1

Related Questions