Use external link in the add sub menu

Last argument of function add_submenu_page is the name of the function to call when display the content of the page. As described here:

http://codex.wordpress.org/Function_Reference/add_submenu_page

The right use is:

add_submenu_page( 'antify', 'Plugins', 'Plugins', 'manage_options', 'plugins', 'my_function' );

function my_function(){
  echo 'hello';
}

If you want a separate file you can do this

add_submenu_page( 'antify', 'Plugins', 'Plugins', 'manage_options', 'plugins', 'my_function' );

function my_function(){
  include plugin_dir_path( __FILE__ ) . 'path/of/file.php';
}

Leave a Comment