• flickeringpixel

    (@flickeringpixel)


    Hello,

    Does anyone know of a method by which I could re-index a specific page (or, specifically, an array of page ids) via a function in my functions.php file?

    A bit of context, I have a function which adds meta data to other posts when the current post is saved (using the save_post hook). But the new meta data is not being indexed. I guess this is because re-indexing would happen when those posts are saved which never happens as I’m writing direct to the database.

    Many thanks,
    Chris

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

    (@msaari)

    Yeah, if the specific hooks don’t trigger, indexing doesn’t happen and Relevanssi doesn’t notice the changes.

    Thus, in many cases, it’s easiest just to fire the triggers. If you fire the wp_insert_post actions for the post, Relevanssi will index it.

    You can also call relevanssi_index_doc() directly:

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

Viewing 1 replies (of 1 total)

The topic ‘Re-indexing a specific page via functions.php’ is closed to new replies.