Relevanssi - A Better Search
[resolved] Custom field data isn't been indexed when posted from front-end. (3 posts)

  1. AndrewMunro
    Posted 3 years ago #

    Hi there, thanks for the plugin. I have a small form on the front end that simply adds a custom field using add_post_meta. Since it's submitted from the front-end, I need to run the indexing again from the plugin's settings in order for it to pick up the custom field data. Is there some way I can hook into your plugin while I'm doing my add_post_meta so that relevanssi indexes it straight away?

    I saw this function but unsure if it's relevant to me:
    relevanssi_index_doc($id, $remove_first, $custom_fields, $bypasspost);

    I should note that I'm not creating a post from the front-end, just adding some custom data for the currently displayed post.

    Thank you!


  2. Mikko Saari
    Plugin Author

    Posted 2 years ago #

    Yes, that is very much the relevant function.

    Call it like this:

    relevanssi_index_doc($post_id, true, relevanssi_get_custom_fields(), true);

    to update a post.

  3. AndrewMunro
    Posted 2 years ago #

    Thank you very much, works perfectly :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Relevanssi - A Better Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic