Support

Account

Home Forums Add-ons Repeater Field Add ACF Repeater Field rows as individual items to Search Results

Solved

Add ACF Repeater Field rows as individual items to Search Results

  • Is it possible to add items to WordPress search? I’m currently using Relevanssi to improve WordPress search and my ACF fields and CPTs are being indexed.

    What I want to do is to show ACF Repeater Field rows as individual items in search. The field is on a CPT, so I would link to those rows using an anchor link from search

  • The simple answer is no.

    WordPress only returns a post as a result once in search results. What you want to do would require WP to return the same post multiple times in the results.

    In order to have them appear as different results they would need to be different posts instead of different rows of a repeater. If this is the results that you need then you should be using different posts instead of a repeater.

  • Thanks for your response @hube2 , you’re always so helpful on here!

    I definitely would have set them up as CPTs instead of repeater rows if I knew the client would want them to be searchable individually!

    I might loop through all the repeater rows and create them as a posts on a hidden/private CPT so that they can still be searchable

  • So. I had a situation where I needed to do something similar.

    Basically the client wanted events that had multiple dates plus they wanted each event date to appear in the archive. To do this I gave them a repeater to set event dates. When they update an event on the acf/save_post hook I create a child post for each event date with all of the needed information from the parent event. The child events are hidden.

    This can be done in any number of ways.

    The hard part was checking the values submitted against posts that already exist and then creating/deleting post as needed.

  • Nice one!

    Re: creating/deleting posts as needed – each of my repeater rows require a file upload so I might use that attachment ID as a ‘key’ for each row to then create/update/delete posts as needed!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.