Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search Search Results for 'search_filter_update_post_cache'

Viewing 10 results - 1 through 10 (of 112 total)
  • Author
    Search Results
  • #288948

    Stefan
    Participant

    Can i use this Code u posted:

    add_action(‘pmxi_saved_post’, ‘wp_all_import_post_saved’, 1000, 1);

    function wp_all_import_post_saved($id) {
    do_action(‘search_filter_update_post_cache’, $id);
    }

    for updating the cache after import with wpallimport? id i understand that the right way?
    do i have to put the code in the function.php or fuction editor ind wpallimport?

    #272878

    Trevor
    Moderator

    This is added to the functions.php file to make sure imported records are indexed by S&F and Relevanssi:

    add_action('pmxi_saved_post', 'wp_all_import_post_saved', 1000, 1);
    function wp_all_import_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
        relevanssi_index_doc($id, true, relevanssi_get_custom_fields(), true);
    }

    I am not sure if you are using Relevanssi or not? If not, you don’t need this line:

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

    #272777

    Ross
    Keymaster
    This reply has been marked as private.
    #272719

    One Ltd
    Participant
    This reply has been marked as private.

    One Ltd
    Participant

    Hi

    We are using an ACF relationship field that gets updated on the ‘acf/save_post’ hook with the values from another 2 acf relationship fields. It all works and I can see the value in the database, however, for certain relationships (even with the database showing the correct data) we can’t see them in the filter options. The relationship is displayed as a ‘checkbox’ filter, where users can tick it and filter.
    I have tried rebuilding the cache, deleting the meta_key and recreating it (in the acf/save_post hook), clearing the wp_cache_delete of that post, and finally also calling do_action(‘search_filter_update_post_cache’, $post_id); for the post and all the posts in the relationship.

    None of which worked. The only way to make it work, is to remove the relationship, update the post (with removed relationship) and then re-add the relationship and update the post.

    I need some help to understand what is the problem.

    #266928

    In reply to: Multiple Tags fields


    Shaun Trivedi
    Participant
    This reply has been marked as private.
    #266664

    White
    Participant

    Hello,

    do_action('search_filter_update_post_cache', $post_id); – this clears thee cache of a particular post.
    But how can I rebuilt the cache of a search form (I am talking about the “rebuild cache” option on the search form edit screen) from code?

    Thanks.

    #265968

    In reply to: Brings Whole Site Down


    Jason Hodge
    Participant
    This reply has been marked as private.
    #264356

    In reply to: Cache at time interval


    Trevor
    Moderator

    Are you using a plugin like WP All Import to update the posts? If so, you would need this code in your child theme’s functions.php file:

    add_action('pmxi_saved_post', 'wp_all_import_post_saved', 1000, 1);
    
    function wp_all_import_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
    }

    If you are also using Relevanssi (a third party text search replacement plugin) and have set the form to use it for text searches, it would need to be this:

    add_action('pmxi_saved_post', 'wp_all_import_post_saved', 1000, 1);
    
    function wp_all_import_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
        relevanssi_index_doc($id, true, relevanssi_get_custom_fields(), true);
    }
    #264108

    Trevor
    Moderator

    Yes, you will need to follow this guidance:

    https://www.relevanssi.com/knowledge-base/wp-import-compatibility/

    You could probably add just this one line:

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

    That’s what I would do, so it would look like this:

    add_action('pmxi_saved_post', 'wp_all_import_post_saved', 1000, 1);
    
    function wp_all_import_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
        relevanssi_index_doc($id, true, relevanssi_get_custom_fields(), true);
    }
Viewing 10 results - 1 through 10 (of 112 total)