My sincere apologies for asking this question as I am quite certain that this is a relatively easy topic, unfortunately my many hours of searching got me no satisfying results. I do not mind researching this further so any links to relevant posts are much appreciated!
The problem
I want my users to land on a specific archive page after using the search form on my home page. Example; when the user uses the search form on mysite.com they are redirected to all results in the archive of a specific custom post type; mysite.com/customposttype/?s=search-therm
I am using Elementor Pro to style the search form and would therefore like to keep this functionality.
Attempts
I built a new search form with a hidden input with the name of my custom post type. This unfortunately still lead to the standard archive (mysite.com/?s=search-term) and not the custom post type archive.
How can I adapt the search form in such a way that I can have multiple search forms on my website that all redirect to a specific custom post type directory?
Thanks!
<form action="urlishere">
- that's where you need to have<form action="example.com/customposttype/
. Then, create a custom template for that archive so if$_POST['s']
is not empty, it searches and displays search results instead of just the normal archive.