/searchwp-customizations.php Secret
Created
March 16, 2022 17:38
Prevent specific Category from being indexed with posts in SearchWP
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 | |
// Prevent specific Category from being indexed with posts in SearchWP. | |
add_filter( 'searchwp\source\post\attributes\taxonomy\terms', function( $terms, $args ) { | |
// Do not index the 'Uncategorized' term. | |
return array_filter( $terms, function( $term ) { | |
return 'Uncategorized' !== $term->name; | |
} ); | |
}, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment