Forums Forums Search & Filter Pro Faster to run search_filter_update_post_cache or wp_update_post?

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #241668

    We import/update 10,000+ posts via a JSON feed, once a week, overnight. New posts are not being cached by Search and Filter Pro, and I understand that we can’t rebuild the whole cache automatically via cron. We use a third-party plugin that cannot be modified to add search_filter_update_post_cache as part of the import process. So anything we do has to happen after the import.

    My solution is to create a cron function that loops through all the posts after the import is complete (yes, all 10,000), and then run do_action('search_filter_update_post_cache', $post->ID) for each post. OR… I could run wp_update_post() on each post. Is one of those methods more efficient than the other?

    OR, is there a better way I’m missing?

    Thank you!

    Trevor
    #241709

    I am thinking that you are going to run through the array of posts added/changed in either case. If you run wp_update_post, it will then trigger the same code in our plugin as would running the search_filter_update_post_cache action. On balance, I would guess that it would be more efficient and slightly faster to run the search_filter_update_post_cache action directly.

    Anonymous
    #241789

    Great, thank you for your insight. That makes sense. You may close this thread now.

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