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