Better Search v3.0.0

After a few months of development, I’m happy to announce that Better Search v3.0.0 has now found its way to the repository. Existing users should be able to see this update within their WordPress sites.

I’ve tested this release including running betas on my own sites but I’m conscious that there might still be bugs. If so, please raise a new support query in the forum. As this is a major release, probably one of the largest for this plugin, I highly recommend going to your settings page and resaving the settings. If you’re using any custom functions to filter the results, I recommend checking that they work properly as most of them have been deprecated.

Additionally, I have now dropped support for PHP 5.6 and below. If you’re still using PHP5.6, please do not upgrade. And, I highly recommend dropping your host!

Introducing Better_Search_Query

I’ve rewritten the query that pulled the search results to use WP_Query under the hood. Better_Search_Query brings the power of WP_Query to an already powerful plugin. You can use it similar to WP_Query but also including the specific settings of Better Search.

This also means that a huge number of functions have been deprecated. For most users this shouldn’t make a difference. However, if you were using the old style custom template, then you will see notices (or warnings) in your PHP logs. And, of course, nothing will work!

I’ve also rewritten the default search template to make use of the new Better_Search_Query and if you’ve used WP_Query before then you’ll be very familiar with the template. I’ve also introduce several new functions that also function as wrappers to WordPress functions. Check out general-template.php for a full list of functions you can use with your custom search template.

Search everything

Better Search v3.0.0 introduces several new settings that allow you also search for posts that contain the search term in meta fields, categories, tags and custom taxonomies, authors, post excerpt and also comments!

Turn on some or many but do remember that each setting you turn on will slow down the time it takes to search for the posts.

Caching improvements

And, that’s why I’ve updated some of the inbuilt caching with transients. If you enable caching from the settings page, the plugin will cache the posts found within a transient and will then retrieve this from the cache should the same term being searched again. This is all self-contained within Better_Search_Query. Remember to turn caching ON in the settings page.

Display results by date

By default, the plugin displays the search results by relevance. If you’re using the advanced search results page, users can choose to reorder the posts by date. The plugin will continue to search relevant results but these will be limited by date.

Advanced search form

v3.0.0 also includes changes to the search form within the plugin. In particular, I’ve introduced a new select dropdown where the results can be narrowed by post type. The search form widget has also been updated to allow you to optionally add the post type drop down.

The form can also be displayed using the_bsearch_form() which echoes get_bsearch_form(). Check out these functions in general-template.php for the full list of parameters.

New stylesheet

I’ve moved the default css rules from the custom styles tab to a stylesheet that is enqueued on search results page and singular posts/pages. The new stylesheet also includes several more styles to make the search results page prettier. These styles will also be included if you use the search form widget.

Note that this will not touch the custom styles setting you have currently. If you’d like to take advantage of the new styles, simply empty the custom style setting.

Highlight search terms

Prior to v3.0.0, search terms were only highlighted on the search results page. Now, clicking through these results will also highlight search terms on the individual posts. This only applies to the title and post content even if other search fields are included like meta or comments.

Detailed changes in Better Search v3.0.x


  • Bug fixes:
    • With seamless mode OFF, by default, all post types were being pulled even those not selected in the settings page
    • With seamless mode ON, caching incorrectly gave the same set of results
    • Exclude categories didn’t save properly if the field is blanked out


  • Enhancements/modifications:
    • New options to disable the display of relevance, post type, author, post date and taxonomies list on the custom search results page
  • Bug fixes:
    • Fixed excerpt_length setting not used in the default template
    • All required attributes are now passed to the shortcodes


  • Enhancements/modifications:
    • New option to disable the automatic addition of the stylesheet
    • Custom search results page now displays Sort by and Sorted by
    • New constant BETTER_SEARCH_VERSION that is used to enqueue scripts and styles
  • Bug fixes:
    • If no excerpt_length is passed, the plugin will use the default value from the settings page
    • Better_Search is only initiated if it is a search results page
    • Custom results page excerpt is now highlighted


  • Features:
    • New classes Better_Search_Query and Better_Search. The latter is a wrapper for WP_Query and brings all the power of WP_Query to Better Search. The former is the core class that filters the required functions as well as replaces the older seamless mode implementation
    • New settings to search taxonomies, comments, excerpt, meta, authors and comments. These will all return the posts corresponding where the search term is found in the above fields
    • New parameter bydate if set to true will sort posts by date
    • Advanced Search form now displays the select dropdown of post types that allows to search a specific post type
    • Highlight search terms on pages referred from the search results page
    • New stylesheet which is enqueued on search results page and singular posts/pages
  • Enhancements/modifications:
    • hellip wrapped in bsearch_hellip span tag for easy access
    • Transients will be deleted when the plugin is removed
  • Bug fixes:
    • Resetting settings caused issues for the default styles and color fields
    • Uninstalling didn’t delete the option key from database.
  • Deprecated:
    • PHP 5.x support has been dropped and attempting to install the plugin on these installs will throw errors!
    • Multitude of functions have been deprecated. Check the deprecated.php file for the full list. Deprecated functions will also throw up a warning
    • Aggressive Search mode has been removed

Download Better Search

Leave a Reply

Your email address will not be published. Required fields are marked *