2017-06-13 6 views

Antwort

8

Wenn Sie über ein Algolia für WordPress-Plugin sprechen, können Sie definitiv eine Funktion/Hook definieren, um zu entscheiden, ob ein Post-Typ indiziert werden soll oder nicht.

Zum Beispiel könnten Sie schreiben: https://community.algolia.com/wordpress/indexing-flow.html#indexing-decision

:

<?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); 

Sie mehr über lesen

Verwandte Themen