-
-
Save searchwpgists/4ae6e45e2a496a151d4e41b7aacbcc6b 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 | |
// @link https://searchwp.com/documentation/multisite/ | |
// 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 sites with ID 1, 2, 3. | |
$args['site'] = [1,2,3]; | |
// 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