-
Notifications
You must be signed in to change notification settings - Fork 312
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
Prevent using the EP if query has unsuported orderby #3273
Conversation
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.
@burhandodhy WP_Query's orderby
also accepts an array and we need to account for that as well. Instead of checking
if ( in_array( $query->get( 'orderby' ), $unsupported_orderby, true ) ) {
we could do something like
if ( array_intersect( (array) $query->get( 'orderby' ), $unsupported_orderby ) ) {
/** | ||
* If WP_Query has unsupported orderby, skip ES query integration and use the WP query instead. | ||
* | ||
* @param bool $skip Whether to skip ES query integration | ||
* @param \WP_Query $query WP_Query object | ||
* @since 4.5 | ||
*/ |
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.
@burhandodhy can we please document the function return as well?
Description of the Change
This PR prevents WordPress to use Elasticsearch if the Query does have unsupported orderby value
Closes #3272
How to test the Change
Changelog Entry
Credits
Props @burhandodhy
Checklist: