SearchWP

This Documentation is for SearchWP Version 3

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

 

[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]
[wpforms id="3080"]