0

http://127.0.0.1/wordpress/wp-admin/admin.php?page=allValue.php

I would like to know the location of allValue.php file.

6
  • 1
    In a plugin, probably. Or it might just be a slug registered in add_menu_page that looks like a PHP filename. You'll have to look at your plugins - it's not from core.
    – Rup
    Mar 26, 2019 at 15:32
  • @Rup Thanks. I am developing a plugin. I would like to know the location. Where should I place the file ?Thanks.
    – abu abu
    Mar 26, 2019 at 15:33
  • 3
    @abuabu It sounds like you're trying to create an admin page in the WordPress dashboard. Is that right? If so, can you provide a bit more context as to what you're trying to accomplish? Here's the codex for creating admin pages: codex.wordpress.org/Adding_Administration_Menus Mar 26, 2019 at 15:58
  • 1
    @abuabu are you asking where an existing admin page is located? Or are you asking how to add an admin page to WP Admin? allValue.php doesn't mean there's a file named allValue.php, it's just a coincidence, it's just an identifier, not a filename, e.g. /wp-admin/admin.php?page=jetpack is valid
    – Tom J Nowell
    Mar 26, 2019 at 16:02
  • Thanks @TomJNowell for your reply. I am asking how to add an admin page to WP Admin. I am trying to develop a Plugin. Thanks.
    – abu abu
    Mar 27, 2019 at 10:37

1 Answer 1

3

I would like to know the location of allValue.php file.

That's not how it works. The value of page doesn't tell WP which file to load, it's just a name, an identifier ( the menu_slug to be specific ).

For example, we can use this code to add a top level menu page to WP Admin:

/**
 * Register a custom menu page.
 */
function registerAbusAdminMenu() {
    add_menu_page(
        'Abus Menu',
        'Abus menu',
        'manage_options',
        'abu',
        'helloAbu'
    );
}
add_action( 'admin_menu', 'registerAbusAdminMenu' );

function helloAbu() {
    echo "<p>Hello Abu!</p>";
}

Notice that the menu slug parameter I chose was abu. Some people don't like picking a menu slug though, they use the name of the file the code is in, but that's just coincidence. WP doesn't use that value to load a file ( that would be a security vulnerability ), it's the 5th argument to the function that controls what gets displayed/loaded, not a filename.

See the docs here for other functions to add submenus, options pages, etc, each function will have explanations and examples

4
  • 2
    I was just putting a similar answer together. Mine also started with "That's not how it works." 😄 Mar 27, 2019 at 14:38
  • @MikeNGarrett feel free to post your own answer, different perspectives on the solution can help understanding, and you might write a better answer :p
    – Tom J Nowell
    Mar 27, 2019 at 14:43
  • Nope! Yours looks great. Mar 27, 2019 at 14:46
  • 1
    Thanks @TomJNowell for your amazing explanation. You are really a BOSS. Thanks
    – abu abu
    Mar 27, 2019 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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