2.0 Upgrade Notes

Before You Upgrade

Search & Filter 2.0 is a major release – this means a lot has changed under the hood.  The admin UI is still fairly similar but there are a good few changes there too.

With this being said please ensure to do the following before upgrading:

  • Backup now before doing anything
  • Ensure WordPress and your other plugins are upto date
  • Update Search & Filter
  • If updating via FTP – please ensure to deactivate and reactivate S&F – this is so the necessary caching tables can be created
  • Resave any existing / problematic search forms – just open a Search form, and update it – this will help ensure there are no configuration glitches and that the cache gets built
  • If you continue to get problems with a particular search form, try recreating it from scratch – or at least a simplified version to test if that works
  • Read the update notes below for Developers

Developer Update Notes

We are still updating and making it easier over time for developers and other plugins to utilise Search & Filter Pro – with 2.0 there has been a considerable rewrite and we’re on the first steps to making S&F more developer friendly.

With that being said and with some of the new functionality added to S&F, some functionality has been changed and there are new ways of using S&F to achieve what you want.

JavaScript Events

The old recommended way of detecting the Ajax events has been replaced with new (similar) jQuery syntax:

No more `pre_get_posts`

Support for this filter has been completely remove due to the new caching and auto count system.  The only reliable way to modify the search query is to use the filter: `sf_edit_query_args`:

Global $sf_form_data removed

This has been replaced with an easier to remember `$searchandfilter`

`is_valid_form` replaced with `active_sfid`

The function `active_sfid()` will return false if no valid form has been found otherwise the ID of the active search form will be returned.


HTML / CSS changes

There haven’t been too many changes to the front end markup but there are a couple of note:

  • Checkboxes and radio inputs have been moved outside their `<label>` – this means you can now add styles using the CSS plus selector and style content based on `:checked` state
  • All inputs now have an ID associated with them
  • Removal of `.postform` classes – these were actually a mistake and should have been removed some time ago – they have now been replaced with more relevant class names such as `.sf-input-checkbox`, `.sf-input-radio`, `.sf-input-select`, `.sf-input-multiselect`