Skip Navigation

[Resolved] Get repeatable field group for Relevanssi search

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1336949

Hi! I have a content type, Location, with a repeatable field group, Unique Feature. I want the content of the repeatable field group to show up in the site search - so if location East Regional has a garden feature, if someone searches for garden, East Regional should show up in the results.

I contacted Relevanssi support to ask how to do this, and they said I can add a filter to index the features like this:
add_filter('relevanssi_content_to_index', 'add_extra_content', 10, 2);
function add_extra_content($content, $post) {
[function to get feature content here]
}
(Here's their KB article about it if that helps: hidden link).

Can you tell me, or point me to documentation about, how to put together a function that will get repeatable field group content for a given post?

Thanks!

#1337259

Hello,

The repeatable field groups are based on one-to-many post type relationship, so each repeatable field group item is also a single post, you can follow our document to get related items of repeatable field group in a single post:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#new-approach

Notice:
In your PHP codes, you can use repeatable field group slug as the relationship slug.