I'm writing a custom form on my plugin settings area.

<form action="<?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_add_multi_set">
            <input type="text" name="multi-set-name" id="new-multi-set-name" class="input-text-multi-set">
            <?php wp_nonce_field( 'add-multi-set', 'add-nonce-new-multi-set' ) ?>
            <input name="action" type="hidden" id="add-nonce-new-multi-set" value="new-multi-set" />

            <?php submit_button(__('Create New Set', 'yasr'), 'primary'); ?> 

When I try to click on submit I got redirect on options-general.php but I need to get redirect on options-general.php?page=yasr_settings_page. How to do that?

2 Answers 2


Just add the attribute method="post" within the form element. That's it :)

Happy coding!

  • Please add a short description to why your code should work and why it should be used May 16, 2014 at 6:37
  • When you are using GET method to process a form, then you would not be able to send the form data to an URL that contains query string. Because actually there is no real script in that location. But if you still need to use options-general.php?page=yasr_settings_page this page as your form action, then the only way is to pass the query string as an input hidden field to your form like this: <input type="hidden" name="page" value="yasr_settings_page" />
    – Saikat
    May 17, 2014 at 6:35

According to the codex, Creating Option Pages, your form should post to options.php.

I assume you have added a menu page in the settings section callback?

Maybe if you post your entire code or at least the setup code, I could be of more help.

  • You should not just post a link as an answer. Please add a short relevant description from the link and also relevant code as an example May 16, 2014 at 6:39

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.