0

I have been facing a problem in wordpress. I have a form as below

<form role="form" action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post">
   <div class="form-group">
          <input type="text" class="form-control required" name="input_name" id="inputName" placeholder="Name*"/>
   </div>
   <div class="form-group">
          <input type="email" class="form-control required" name="input_email" id="inputEmail" placeholder="Email*"/>
           <input type="hidden" name="action" value="download_catalog"/>
   </div>
   <div class="form-group">
           <input type="text" class="form-control" id="inputMobile" name="input_mobile" placeholder="Mobile"/>
    </div>
</form>

And i have added the admin post hook in my functions.php as

add_action('admin_post_download_catalog','download_catalog');
add_action('admin_post_nopriv_download_catalog','download_catalog');
function download_catalog() {
   print_r($_POST);wp_die();
}

But every time I submit the form it redirects to search results page.

I have also tested by updating the permalink and also deactivating plugins. Nothing happened it redirects to domain/home/s?= . Please help me . Thanks in advance

  • I would first try to Flush all redirects/Cookies from Browser to be sure nothing is cached. – Drupalizeme Nov 24 '17 at 9:29
0

Caching is a tricky thing to achieve. You don't want the users to see it and make them do extra work.

This is way browsers try to cache as much as a reasonable thing they need to do.

301 Redirects

This type of redirect is cached by browsers.

301 Moved Permanently. A 301 redirect is a permanent redirect which passes between 90-99% of link juice (ranking power) to the redirected page. 301 refers to the HTTP status code for this type of redirect. In most instances, the 301 redirect is the best method for implementing redirects on a website. Moz

Cookies

Most time include pieces of content specific to the current user

Local storage

Not so much used by applications but can have data necessary to function-specific parts of web apps.

Solutions

The first try will be to Deactivate plugins and also remove redirects in the .htaccess.

Flushing WordPress rewrite rules.

Flushing the rewrite rules is an expensive operation, there are tutorials and examples that suggest executing it on the 'init' hook. This is bad practice. It should be executed either on the 'shutdown' hook, or on plugin/theme (de)activation. Codex

Clear Cache and Cookies

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.