How to Make the Search Feature in Your Blog Only Search Blog Posts
Editing Your Blog Search Box to Only Produce Results in Your Blog
Recently a client asked us if we could adjust the blog search feature to only search posts in the blog (rather then searching individual pages of the website).
Why, yes – we can and so can you. To do this just add the line of code below.
<input type=”hidden” name=”post_type” value=”post” />
By adding this line of code you will only generate search results withing the blog platform. It is a quick and simple adjustment that can make the content within your blog more searchable.
Check out these other quick fixes:
- Fixing the get_posts() Query for Custom Post Types
- HTML and You: The Basics for Your Law Firm Website
- Use Your .htaccess File to Redirect an Alternative Domain