Get search text value in URL

I have a form like this

<form method="get" id="searchform" action="http://domain.com">
    <input name="s" id="s" type="text" />
    <input type="submit" id="searchsubmit" type="submit" />
</form>

When I add some keyword on search input text, The URL is going as http://domain.com/?s=keyword

Read More

I need it as http://domain.com/?s=keyword&post_type=events

Means I need just &post_type=event added on url. How can I do it? any suggestion?

Related posts

Leave a Reply

2 comments

  1. Please try this code…

    <form method="get" id="searchform" action="http://domain.com">
        <input name="s" id="s" type="text" />
        <input type="submit" id="searchsubmit" name="post_type" value='event'/>
    </form>
    

    When you press button it return to like.

    http://domain.com/?s=keyword&post_type=events