-
-
Save jchristopher/eaae9852a5a49ebee11293213be58cae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Tell SearchWP to search the entire Multisite network when searching on the main site. | |
add_filter( 'searchwp\query\args', function( $args, $query ) { | |
// If this is not site 1, bail out. | |
if ( 1 !== get_current_blog_id() ) { | |
return $args; | |
} | |
// Search all sites. | |
$args['site'] = 'all'; | |
// Retain site info in results. | |
$args['fields'] = 'default'; | |
return $args; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment