results

a minute read
Although WordPress traditional search doesn’t provide search quality as good as Google Custom Search, however many WordPress users still use it, as it is the default search and you don’t need to customize your theme to add search feature on your blog. Recently, a friend of mine asked me about redirecting to a post when search results have only one item. Such needs may differ from site to site, it all depends on your audience and what features you want to add to your site for their ease. In t...
a few seconds read
The native WordPress search feature by default displays pages in the search results. The feature is meant for site-wide searches, but could be annoying to users who just want to display only the posts in the search results. I have this small code snippet working for me from day one to exclude pages from the searches. It goes in the functions.php file of your WordPress theme: function search_tweak( $query ) {   if( $query->is_search ) {     $query->set( 'post_type', 'post&...