Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Search: Add a hook on returning filters. (jetpack:10706)
Summary: <!--- Provide a general summary of your changes in the Title above --> Fixes N/A(?) #### Changes proposed in this Pull Request: <!--- Explain what functional changes your PR includes --> I recently had a use case where I wanted to add custom filters (i.e. not a taxonomy, post type or date histogram) and found I could set the filter no problem but `get_filters()` would ignore it as it wasn't supported. I'd like to be able to easily support custom filters through a hook into `get_filters()`. #### Testing instructions: <!-- Please include detailed testing steps, explaining how to test your change. --> <!-- Bear in mind that context you working on is not obvious for everyone. --> <!-- Adding "simple" configuration steps will help reviewers to get to your PR as quickly as possible. --> <!-- "Before / After" screenshots can also be very helpful when the change is visual. --> * Add custom filters using `set_filters()` e.g. ```php Jetpack_Search::instance()->set_filters( [ 'Price Range' => [ 'type' => 'range', 'label' => 'price_range', 'field' => 'price', 'ranges' => $ranges, 'count' => count( $ranges ), ], ] ); ``` Call `get_filters()` and observe that the added (unsupported) filter is not available. #### Proposed changelog entry for your changes: <!-- Please do not leave this empty. If no changelog entry needed, state as such. --> * Added hook to `get_filters()` to allow the use of custom filters. -- Automatically created by Jetpack Fusion from a Pull Request: #10706 Test Plan: - [ ] Dummy test plan. Reviewers: benoitperson, hypertextranch, gibrown, github-phab-bot Tags: #touches_jetpack_files Differential Revision: https://[private link] Merges r185368-wpcom.
- Loading branch information