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

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

Available since: 1.3

searchwp_prevent_indexing

Note: Use of this hook will require a manual reindex

If you would like to ensure that certain posts are completely ignored both when indexing and searching, this filter allows you to do just that.

Example: To prevent certain posts from being indexed and searched, add the following to your active theme’s functions.php:

<?php
function my_searchwp_prevent_indexing() {
$post_ids = array( 15, 90 ); // EXCLUDE posts 15 and 90 from the index and searches
return $post_ids;
}
add_filter( 'searchwp_prevent_indexing', 'my_searchwp_prevent_indexing' );
view raw gistfile1.php hosted with ❤ by GitHub

 

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