Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
searchwp\auto_update_providers hook example
// Tell SearchWP to automatically update its providers when switching sites.
// @link
add_filter( 'searchwp\auto_update_providers', '__return_true' );
// Retrieve results from this site.
$searchwp_site_1 = new \SWP_Query( [
's' => 'coffee',
] );
// Retrieve results from site 2.
switch_to_blog( 2 );
$searchwp_site_2 = new \SWP_Query( [
's' => 'coffee',
] );
// Restore the original site.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment