Note: You are viewing the documentation for Version 4View Version 3 Docs


Since: 4.0.0

Table of Contents

Manipulate the taxonomy terms for a post prior to indexing. Applies only when the Taxonomy has been included in an Engine.

See also searchwp\source\post\attributes\taxonomy\term to filter individual terms.


Type Parameter Default Since
WP_Term[] $terms Taxonomy Term objects 4.0.0
Array $args
Key Type Value
taxonomy String Taxonomy name
post_id Integer Post ID
post_type String Post Type


All hooks should be added to your custom SearchWP Customizations Plugin.

Prevent specific Category from being indexed with posts

Do not index the Uncategorized Category term when indexing.

// Prevent specific Category from being indexed with posts in SearchWP.
function( $terms, $args ) {
// Do not index the 'Uncategorized' term.
return array_filter( $terms, function( $term ) {
return 'Uncategorized' !== $term->name;
} );
20, 2

How to use this code

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP