Skip to content
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

Add filter ep_integrate_search_queries #2735

Merged
merged 3 commits into from
May 3, 2022
Merged

Add filter ep_integrate_search_queries #2735

merged 3 commits into from
May 3, 2022

Conversation

rebeccahum
Copy link
Contributor

@rebeccahum rebeccahum commented May 2, 2022

Description of the Change

This adds a filter to integrate_search_queries() in case someone wanted to filter how they wanted to integrate their search queries. For example, if they wanted search queries with an empty 's' parameter, they should be able to use the filter to do so.

Alternate Designs

N/A.

Possible Drawbacks

N/A.

Verification Process

  1. Apply PR
  2. Add the filter:
add_filter( 'ep_integrate_search_queries', 'empty_search_integrated_request', 10, 2 );

function empty_search_integrated_request( $enabled, $query ) {
	if ( empty( $query->query_vars['s'] ) ) {
		$enabled = true;
	}

	return $enabled;
}
  1. Go to an empty search page aka example.com/?s=
  2. Expect to see search query offloaded still

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Added - New filter ep_integrate_search_queries

Credits

Props @rebeccahum

@rebeccahum rebeccahum requested a review from felipeelia May 2, 2022 20:56
felipeelia
felipeelia previously approved these changes May 2, 2022
@felipeelia felipeelia merged commit f6c9709 into 10up:develop May 3, 2022
@felipeelia felipeelia added this to the 4.2.0 milestone May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants