2017-06-13 13 views

答えて

8

WordPressプラグインのAlgoliaについて話しているのであれば、投稿タイプをインデックスに登録するかどうかを決定する関数/フックを明確に定義することができます。あなたが書くことができる。例えば

<?php 
/** 
* @param bool $should_index 
* @param WP_Post $post 
* 
* @return bool 
*/ 
function exclude_post_types($should_index, WP_Post $post) 
{ 
    if (false === $should_index) { 
     return false; 
    } 

    // Add all post types you don't want to make searchable. 
    $excluded_post_types = array('myprivatetype');  
    return ! in_array($post->post_type, $excluded_post_types, true); 
} 

// Hook into Algolia to manipulate the post that should be indexed. 
add_filter('algolia_should_index_searchable_post', 'exclude_post_types', 10, 2); 

あなたは上の詳細を読むことができます:​​

関連する問題