-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search: Add a hook on returning filters. #10706
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: November 26, 2018. Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor changes in the docblock.
/** | ||
* Modify the filters returned by get_filters() | ||
* | ||
* @module search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're passed the code freeze for 6.8.0, so you'll need to update this to 6.9.0
I'm afraid.
@@ -1610,7 +1610,17 @@ public function get_filters( WP_Query $query = null ) { | |||
} // End foreach(). | |||
} // End foreach(). | |||
|
|||
return $aggregation_data; | |||
/** | |||
* Modify the filters returned by get_filters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand on that title a bit so we know what filters this is referring to? That information will end up being displayed in our codex, so it's important to be as detailed as possible for anyone looking for that filter in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some more info, let me know if that's ok. 👍
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().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. @xyu Could you take a look as well?
Thanks!
@bperson Thanks for jumping in! My bad! It can definitely wait, since we are in code freeze we are not going to be able to include this in the next release anyway. |
Any update? |
@jenkoian The PR is marked as Ready to Merge, so it will be included in the next Jetpack release, scheduled for the beginning of January. We'll merge the PR before the code freeze and it will be included in the Beta that will be available a week before the stable release. |
@jeherve thanks for the info :) |
D22545-code. (newly created revision) |
* Add first version of the Changelog and testing list for 6.9 * Changelog: add #10710 * changelog: add #10538 * changelog: add #10741 * changelog: add #10749 * changelog: add #10664 * changelog: add #10224 * changelog: add #10788 * Changelog: add #10560 * Chanegelog: add #10812 * changelog: add #10556 * Changelog: add #10668 * Changelog: add #10846 * Changelog: add #10947 * Changelog: add #10962 * Changelog: add #10956 * Changelog: add #10940 * Changelog: add #10934 * Changelog: add #10912 * changelog: add #10866 * changelog: add #10924 * Changelog: add #10936 * Changelog: add #10833 * changelog: add #10867 * Changelog: add #10960 * Changelog: add #10888 * changelog: add #10840 * changelog: add #10972 * Changelog: add #10979 * changelog: add #10909 * Changelog: add #10958 * Changelog: add #10981 * Changelog: add #10564 * Changelog: add #10809 * Changelog: add #10982 * Changelog: add #10706 * Changelog: add #10978 * Changelog: add #10132 * Changelog: add #11022 * Changelog: add #11024 * Changelog: add #10875 * Changelog: add #11030 * Changelog: add #11053 * Changelog: add #10880 * Changelog: add #9359 * Changelog: add #11037 * Update block list * Changelog: add #11060 * Changelog: add #10755 * changelog: add #11000 * Changelog: add #10786 * Changelog: add #10945 * Changelog: add #10597
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.
Fixes N/A(?)
Changes proposed in this Pull Request:
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'tsupported.
I'd like to be able to easily support custom filters through a hook into
get_filters()
.Testing instructions:
set_filters()
e.g.Call
get_filters()
and observe that the added (unsupported) filter is not available.Proposed changelog entry for your changes:
get_filters()
to allow the use of custom filters.