Need help getting Relevanssi to index custom fields in custom database table

Support MB Custom Table Need help getting Relevanssi to index custom fields in custom database tableResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #46177
    Touchdown TechTouchdown Tech
    Participant

    I need help getting Relevanssi to index custom fields in the custom tables created with MB Custom Tables.

    Here's a video from the developer of ACF Custom Database Tables: https://www.youtube.com/watch?v=Mph9lALMmR8

    An official Meta Box video similar to what the ACF team created would be really valuable for anyone using Relevanssi search.

    #46184
    PeterPeter
    Moderator

    Hello,

    I think there is no difference between the custom table of ACF or Meta Box. You can follow the same steps to use Relevanssi to index the field value stored in a custom table.
    Please follow their documentation https://www.relevanssi.com/knowledge-base/metabox/

    #46238
    Touchdown TechTouchdown Tech
    Participant

    The code provided in the YouTube video used by ACF Custom Tables didn't work. Relevanssi support was quick to respond and they had a code snippet that did work! Here it is below. I asked for additional help supporting multiple custom tables and custom fields within those tables.

    add_filter( 'relevanssi_content_to_index', function( $content, $post_object ) {
      $args = [
        'storage_type' => 'custom_table',
        'table'        => 'table_name',
      ];
      $content .= ' ' . rwmb_meta( 'field_name', $args, $post_object->ID );
      return $content;
    }, 10, 2 );
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.