Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Last active July 20, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rayrutjes/2a82931e85fe608733a6727c6342f929 to your computer and use it in GitHub Desktop.
Save rayrutjes/2a82931e85fe608733a6727c6342f929 to your computer and use it in GitHub Desktop.
Exclude home page WordPress Algolia plugin
<?php
// functions.php
define( 'CUSTOM_HOME_ID', 2 );
function custom_should_index_post( $flag, WP_Post $post ) {
if ( $post->post_type === 'page' && $post->ID === CUSTOM_HOME_ID ) {
return false;
}
return $flag;
}
add_filter( 'algolia_should_index_post', 'custom_should_index_post', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment