Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] How to make Excerpts show Custom Fields

  • Hi,

    I have installed Relevanssi and it is working. I also installed “Advanced Custom Fields” which I am using to place all Posts into metatagged sections. (Picture a recipe site, with textboxes for each section: Ingredients, Prep Time, Cook-Time, Allergens, Instructions, etc.)

    Relevanssi is able to search the Custom Fields, but the excerpts shown in the Search Results show only “…”

    Is there a way to make Relevanssi able to:

    1) Choose to search within all Custom Fields, or only within selected Custom Fields? (For example, if someone wants to search only within Ingredients, for cinnamon or for NOT cinnamon. Or search only within Instructions, for NOT bake, if they don’t have an oven.)

    2) Return excerpts which show not “…” but instead the Custom Fields content?

    – Is all the code for Relevanssi contained within the file relevanssi.php?


    Oh ps- Can probably use a different custom field plugin if need be.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mikko Saari


    Looks like you found the instructions on on how to make excerpts show up in excerpts.

    You can restrict the search to a particular custom field in Relevanssi Premium, because Premium knows which custom field has what content. The free version doesn’t know that and can’t use it to restrict the searches. Making this work in Premium does take some programming.

    And yes, relevanssi.php does contain all Relevanssi code.

    Mikko, you are so courteous to answer all these posts. I found the instructions and can get Premium certainly, my boss never minds paying for a few scripts.

    Are there non-programmer instructions for fixing functions.php file?
    Or are you available for hire to fix the php file like that, or do you have a custom order page somewhere that I could use? Or want some design work in trade?

    Plugin Author Mikko Saari


    Oh, by the way, Relevanssi doesn’t do NOT queries at the moment, so you can’t use Relevanssi to do a search like that. (However, it’s possible, if a bit complicated, to do a filter that would clean out unwanted documents from the results.)

    Actually, you don’t need programming to restrict searches to a particular custom field. This should work:

    This would search for documents that contain the word ‘term’ and have the word ‘cinnamon’ in the custom field ‘ingredients’.

    Small custom fixes are included in the Relevanssi Premium standard and developer licenses, and I can be hired for larger modifications.

    How hard would it be to make it do “-” and “NOT”?

    I made a mistake and thought it already did. It’s one of the requirements my boss gave me.

    Thanks for your replies!

    Plugin Author Mikko Saari


    Depends. What kind of user interface you have for the search? If there’s a separate field for NOT searches, so that there’s no need to parse queries to figure out what part is NOT and what part isn’t, then it’s fairly straightforward.

    I wanted an Advanced Search form similar to Google, but I will also add some checkboxes for searching only within certain Custom Fields. So I can add a NOT searchbox.

    Seems like that part should be fairly straightforward yes, if I knew any coding syntax. I copy code and then use trial and error, lol.

    Plugin Author Mikko Saari


    In that case it’ll be fairly simple, yes. I can help you with the code. Email me at mikko @

    I have a site where i list my ebooks using list yo’ files Ther are over 5000 files listed that are linked and can be downloaded. The normal search does not work on dynamic content. I had Relevanssi installed and indexed one site that worked. i run multisite and tried another site and it would not index. went back to the first site and it indexed but searches came up empty. removed Relevanssi and reinstalled not network activated. tried active on one site.It indexes but no result on search

    Plugin Author Mikko Saari


    And your question is?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] How to make Excerpts show Custom Fields’ is closed to new replies.