Continue reading ACF: Indexing files from File fields

ACF: Indexing files from File fields

Relevanssi can index attachment contents from files linked to posts with ACF File fields. This does not happen automatically but requires some extra code. The code required depends on which return value you use for your ACF File fields. If you use “File ID”, the code looks like this: For “File Array”, the code looks…

Read more ACF: Indexing files from File fields 1 Comment on ACF: Indexing files from File fields
Continue reading ACF: Filtering custom fields by type

ACF: Filtering custom fields by type

On sites where ACF fields are used a lot, with Flexible Content and Repeater fields, it may be difficult to make Relevanssi only index the relevant ACF fields. One way to deal with problem is to set Relevanssi to index “visible” custom fields and then restrict the indexed fields by field type. Add this function…

Read more ACF: Filtering custom fields by type 0 Comment on ACF: Filtering custom fields by type
Continue reading ACF: Field names appearing in excerpts

ACF: Field names appearing in excerpts

…think it has). Since that too is a visible field, Relevanssi indexes it and uses it for excerpts. Thus the layout names appear in excerpts. The solution to this problem is to remove the root field, flexible_content, from the Relevanssi index and excerpts. That is a straightforward thing to do……with a filter function: add_filter( ‘relevanssi_index_custom_fields’, ‘rlv_remove_unwanted’ ); function rlv_remove_unwanted( $fields ) { $unwanted_fields[] = ‘flexible_content’; return array_diff( $fields, $unwanted_fields ); } Add this function to your site and rebuild the index. Now the root field is no longer indexed or used in excerpts. Another approach is to stop using……and rebuild the index. Now the root field is no longer indexed or used in excerpts. Another approach is to stop using “Visible” in the custom field indexing settings and instead specify the exact fields you want Relevanssi to index. Still, with lots of Flexible Content, that can be complicated….

Read more ACF: Field names appearing in excerpts 4 Comments on ACF: Field names appearing in excerpts
Continue reading ACF: Indexing File field title

ACF: Indexing File field title

I use the ACF field type File for a download section, but the displayed file title is not indexing. The format I return the ACF field data is “File Array (array)”. For Relevanssi, it doesn’t matter which ACF return format you choose. Relevanssi doesn’t use get_field() but instead uses the plain get_post_meta(). That always returns…

Read more ACF: Indexing File field title 0 Comment on ACF: Indexing File field title
Continue reading ACF: Indexing relationship content

ACF: Indexing relationship content

…know the exact field name. In that case you can use a direct database call to fetch fields using wild cards. This function would find a relationship field called people inside a flexible content field sidebar_groups: add_filter( ‘relevanssi_content_to_index’, ‘rlv_relationship_content’, 10, 2 ); function rlv_relationship_content( $content, $post ) { global $wpdb;…

Read more ACF: Indexing relationship content 2 Comments on ACF: Indexing relationship content