WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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' ) );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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