Let's say I create a plugin with a menu page and three different submenu pages. How can I determine the URI for each one of them? For example, if I want to have a link on one of the pages to one of the other pages, how do I do that?

I had this problem before, too, when I created a form to gather some information. I ultimately solved it by having the page that defined the form handle it. Like this:

<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">

How would I let another page handle the form data, i.e. what would I put in the action parameter.

I noticed some people hardcode the URI one way or another, for example through


But that won't work with all URL schemes.


You can dynamically generate those URLs like this:

$url = add_query_arg( array(
    'page' => 'slug', // whatever the page slug should be, either for this page or the other pages
), admin_url( 'options-general.php' ) );

Your Answer

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