I want to show the data in the external plugins.php file. the below url path is correct but its not showing the file data. Whats the problem?

add_submenu_page( 'antify', 'Plugins', 'Plugins', 'manage_options', 'plugins', ANTIFY_PLUGIN_URL . '/admin/pages/plugins.php' );


echo 'Hello World';
  • What the ANTIFY_PLUGIN_URL is producing? Dec 28 '14 at 16:24
  • thats the total url: localhost/Antify/wp-content/plugins/antify/admin/pages/plugins.php Dec 28 '14 at 17:24
  • The last argument accepts callback, not file path. You are mixing something up here.
    – Rarst
    Dec 28 '14 at 18:42
  • then how do i use the php file ? i want a separate file for the sub menu pages Dec 28 '14 at 18:44

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:


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';
  • why this not accepting the url path(www.localhost.com/...) but is accepting the directory path(c:/localhost/www/...). Dec 29 '14 at 3:06
  • The php statement include require absolute or relative path of the file to include. It works server-side so it doesn't use URL. Thi is the php documentation php.net/manual/it/function.include.php
    – jep
    Dec 29 '14 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.