2016-10-11 23 views

回答

2

你可以做以下的ID,以排除某些職位:

/** 
* @param bool $flag 
* @param WP_Post $post 
* 
* @return bool 
*/ 
function custom_should_index_post($flag, WP_Post $post) { 

    // TODO: Replace with your own post IDs to exclude. 
    $excluded_ids = array(20, 25); 
    if (in_array($post->ID, $excluded_ids)) { 
     return false; 
    } 

    return $flag; 
} 

add_filter('algolia_should_index_post', 'custom_should_index_post', 10, 2); 
add_filter('algolia_should_index_searchable_post', 'custom_should_index_post', 10, 2); 

當然,你也可以的基礎上,如職位類型或自定義屬性的任何其他值決定。