Limit Search Results to Blog Posts Only

The following snippet will limit search results to display blog posts only on your search results page. Copy and paste the following into functions.php


How to add a search form

Here is how to add a search form in WordPress. You can use the following code and it will load the default search box:

Or, you can use the following to customize your own search box