• Resolved bonsaimedia

    (@bonsaimedia)


    Would it be possible to exclude the indexing of the the content for a custom post type? I want these posts to only be indexed by title.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes. Use the relevanssi_post_content hook to blank out the content for that post type:

    add_filter( 'relevanssi_post_content', function( $content, $post ) {
    if ( 'custom_post_type' == $post->post_type ) {
    $content = '';
    }
    return $content;
    }, 10, 2 );
    Thread Starter bonsaimedia

    (@bonsaimedia)

    Thank you! It looks like this works. Would it also be possible to exclude certain meta fields (made with ACF)?

    Plugin Author Mikko Saari

    (@msaari)

    Yes. You can either list only the fields you want to index in the Relevanssi indexing settings or use relevanssi_index_custom_fields to control things.

    Thread Starter bonsaimedia

    (@bonsaimedia)

    Thanks, I got everything working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.