Skip to content

Instantly share code, notes, and snippets.

@stephensabatini
Created November 9, 2020 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephensabatini/74921ddd46d532021b14f37ceaa2ae3d to your computer and use it in GitHub Desktop.
Save stephensabatini/74921ddd46d532021b14f37ceaa2ae3d to your computer and use it in GitHub Desktop.
Solr Power Plugin Support
<?php
/**
* Integrate Solr Power plugin support.
*
* @author Stephen Sabatini <info@stephensabatini.com>
* @license MIT
*/
add_filter( 'pre_get_posts', 'solr_search' );
function solr_search( $query ) {
if ( is_plugin_active( 'solr-power/solr-power.php' ) && ! is_admin() && $query->is_main_query() && $query->is_search() ) {
$query->set( 'solr-integrate', true );
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment