• 1) We recently changed a post, but the old content is still showing in the Relevanssi search results. We rebuilt the index, but no change. Actually I can still find the old string in the DB, but it’s not in any of the ACF fields on that page, or even in the editor. Might it be in an old/unused ACF field? How/why would Relevanssi be pulling content that’s not visible on the page or even in the editor?

    2) If we check “use custom field content for building excerpts” then we get relevant results from the NEW content on the page — which solves the problem for the page above. Unfortunately, for other pages it is causing ID#s, field names, and options that are NOT visible on the page to be displayed in the search results. On the Excerpts and highlights tab it says “Current custom field setting: all visible custom fields” but we’re still seeing non-visible ACF values in the search results. How do we keep non-visible ACF fields out of the search results?

    Thank you!

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

Viewing 8 replies - 31 through 38 (of 38 total)
  • Thread Starter supernaut510

    (@supernaut510)

    Now that you have added the “exclude from relevanssi” toggle, the filter function has been removed from functions.php.

    Plugin Author Mikko Saari

    (@msaari)

    I don’t know why Relevanssi isn’t filtering out the Flexible Content field; it should, the ACF functionality in Relevanssi is built that way. You can try this function:

    add_filter( 'relevanssi_index_custom_fields', function( $fields ) {
        return array_filter(
            $fields,
            function( $field ) {
                $flexible_content_fields = array(
                    'flexible_content2',
                );
                return ! in_array( $field, $flexible_content_fields, true );
            }
        );
    } );

    This should stop Relevanssi from using the flexible_content2 field in indexing and excerpts. Does that work?

    Thread Starter supernaut510

    (@supernaut510)

    Does that mean that all of the sub-fields of “flexible_content2” will also be ignored? Because that would probably be the majority of content on the whole site. Is there no way to exclude only the layout names?

    Plugin Author Mikko Saari

    (@msaari)

    No, it doesn’t. It means only the layout names are excluded, because that’s the only thing that specific field contains.

    Thread Starter supernaut510

    (@supernaut510)

    I think we’re getting close. I have excluded the flexible_content2 layout and that seems to work on staging. However, since deploying to live/production, we are getting “0” as the excerpt on some pages (see https://ben.edu/?s=library). This may be unrelated, because when I remove the code, I still get a “0”. But I have the same functions file on staging and production, yet I’m getting different excerpts on each — any idea why? I have tried re-building the index, to no avail. This is a live site, and I need to find a solution quickly.

    Also, we have 38 other flexible content fields — how can I find the DB names for those, so they can also be excluded?

    Thread Starter supernaut510

    (@supernaut510)

    Never mind the “0” excerpt question. I had tried excluding the layouts (using your toggle) to get rid of the layout names, and it was excluding all sub-fields.

    Just need to know how to find the DB version of each layout name, and I think we’ll have this solved. Thanks.

    Plugin Author Mikko Saari

    (@msaari)

    Go to the Field Group settings in ACF. It’s the “Field Name” of the Flexible Content field.

    Thread Starter supernaut510

    (@supernaut510)

    Gah…of course. Over- (or under-) thinking things. ??

    Thank you, thank you, thank you for your help. You have gone above and beyond and it’s greatly appreciated!

Viewing 8 replies - 31 through 38 (of 38 total)
  • The topic ‘Strange excerpt issues using ACF’ is closed to new replies.