Support

Account

Home Forums Front-end Issues WP search suggest excludes custom fields

Solved

WP search suggest excludes custom fields

  • Hello, I have a pretty annoying problem and as a last resort I ask here.

    I have this site where I use this plugin. I provides suggestions for pages and posts based on what the user types in to the search field. At first, it didn’t recognize any content that were being outputted with ACF, but after implementing this code in functions.php all the content were found.

    But the problem with the suggestions remain. Say that I have two pages, page A and page B, both contain Lorem Ipsum but the content on page A are being outputted with WordPress’ own the_content(); and the content on page B are being outputted with ACF’s the_field();. In the suggestions however, only page A is displayed when I type Lorem. If I hit enter at that point I end up at the search results page with both page A and page B.

    I’ve asked the plugin author and he said:

    It uses WP_Query internally, so it works like any other search. If you made your custom fields available to search in general it should also show up in suggestions.

    Is there anyone on here that can help me getting this to work?

    Thank you

  • Hi @nyla

    Please keep in mind that WordPress won’t search custom field by default. That’s why you need to add the code described on the link you gave me to make it work. Now, with that code included, the issue is that your site has the ability to search the custom fields, but the suggestion not. In this case, kindly ask the plugin author regarding this issue because we can’t do anything with it.

    I hope this makes sense 🙂

  • Yes this makes total sense. As I said, I only wrote here as a last resort.

    Thank you for your answer.

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

The topic ‘WP search suggest excludes custom fields’ is closed to new replies.