Better Search v2.2.0 brings the Settings API

Better Search v2.2 has been in the works for several months as I slowly progressed over many of the changes below. The latest version of the plugin is now available for download from WordPress.org. Existing users can upgrade from within their Dashboard as usual. If you’re looking for support, please create a new post in the WordPress.org support forums.

New Admin interface based on Settings API

Since the beginning, Better Search has used its own custom settings interface and didn’t implement the inbuilt Settings API. This has worked well for a long time, but I’ve been keen on moving all my plugins to the API. Better Search follows after Knowledgebase and Top 10.

When you install the new plugin, your existing settings should automatically be upgraded. While I’ve tested this sufficiently, there is always a chance, based on my experience with Top 10, that this update might not always go through. Please verify that the Settings have migrated over when you upgrade the plugin to v2.2.

Better Search v2.2 - Settings API
Better Search v2.2 – Settings API

The old settings key remains stored in the database even after the upgrade and I suggest deleting the key by visiting the tools page once you’re happy that the settings have been upgraded. In case you don’t delete the old settings key, then hitting the “Reset all settings” button will simply restore the old settings from this key.

New Tools page

With the upgrade, I have also moved a few buttons into its separate Tools page. You can clear the cache, recreate the index, reset the searches tables or delete the old settings from this page.

Better Search v2.2 - Tools page
Better Search v2.2 – Tools page

Better Seamless mode

Seamless mode provides complete integration with your WordPress theme by overwriting default WordPress queries. This ensures that you get the benefits of relevant results without having to make major changes to your theme.

I’ve modified the queries by no longer searching for and then passing post IDs as earlier but directly using the index and match clauses like the plugin does. This allows WordPress to take care of the outputs.

New shortcode

You can now use bsearch_form to display the search form generated by Better Search anywhere in a post or page.

 

Detailed changelog in v2.2.0

  • Features:
    • New option to exclude password protected posts from the results
    • New option to exclude post/page or custom post type IDs from the results
  • Enhancements:
    • Admin interface now uses the Settings API – Please double check your settings. You can delete the old settings using the Tools sub-menu
    • New shortcode bsearch_form to display the Better Search custom search form
    • Use template_include instead of template_redirect
    • Seamless mode now uses Better Search queries directly instead of passing post IDs
  • Deprecated:
    • $bsearch_url, bsearch_default_options(), bsearch_read_options(), bsearch_clause_prepare()

Download Better Search