Skip to content

Instantly share code, notes, and snippets.

@msaari
Created December 29, 2020 03:33
Show Gist options
  • Save msaari/41a5637f5a7137d9f9e3da21de1c06a7 to your computer and use it in GitHub Desktop.
Save msaari/41a5637f5a7137d9f9e3da21de1c06a7 to your computer and use it in GitHub Desktop.
Excluding posts from the Relevanssi index
<?php
// Put this in your theme functions.php
add_filter( 'relevanssi_do_not_index', 'rlv_skip_page', 10, 2 );
function rlv_skip_page( $skip, $page ) {
$excluded_pages = array( 123, 234 ); // List all the ID numbers of the excluded pages here.
if ( in_array( $page, $excluded_pages, true ) ) {
$skip = true;
}
return $skip;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment