search

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&...
2 minutes read
The default WordPress search is the only thing that used to annoy me a lot and I wasn’t using it on any of my WordPress sites. There are a number of reasons back then to stop using WordPress search feature, and the best one for me was it throwing unrelated links in the site search results. However, we can tweak the traditional search feature a bit to make it better and keep using it on our sites. Well, this post is not about why WordPress search is bad, it’s about how to forbid or disable Wo...