Forums Forums Search Search Results for 'search_filter_update_post_cache'

Viewing 10 results - 21 through 30 (of 89 total)
  • Author
    Search Results
  • #238754

    In reply to: Cache Building


    Trevor
    Participant

    I am not sure what you mean. Our cache will build automatically. It rebuilds when you save a form and the source data has changed, and isn’t already in the cache. This would normally happen in the background, but some servers are not configured to allow background building of the cache, so in those cases the form has to stay open whilst it builds. a message would appear to tell you this.

    Every time a post is saved in the normal way (in the WordPress editor), WordPress triggers and action that our plugin uses to update the cache for just that post, so that too is automatic.

    The only time it would not be automatic is if you saved a post or changes to a post in a different way. For example, using an import plugin, and sometimes if posts are made with custom front end data entry forms. We have this action (that has to be run after each post is saved by the import plugin):

    https://searchandfilter.com/documentation/action-filter-reference/#update-cache-for-a-particular-post

    For example, for WP All Import, in your (child) theme functions.php file you would use this code:

    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);
    }
    #236441

    Anonymous
    Inactive

    Hi,

    I’m having the same problem as mentioned in this thread: https://support.searchandfilter.com/forums/topic/not-showing-all-results-2/

    This is in my 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);
    }

    But unfortunately this does not help. Is there anything else I can try?

    Thanks!

    #236300

    Trevor
    Participant

    @Oris

    You might need to renew your licence to get v2.5.0.

    This code in functions has been changed a little to make it trigger much later:

    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);
    }

    (1000 instead of 10)

    @Melvin. You would need to renew your licence and then update the plugin to 2.5.0 and start a new thread, as this thread has private posts that I cannot show you.

    #236060

    In reply to: Index individual post


    Trevor
    Participant

    When our plugin uses Relevanssi, it only does so when there is a text search, so, yes, if a post is missing from the Relevanssi index and you do a search that includes a text search, it will be missing from the results.

    If you are importing posts using WP All Import, for example, both our cache and the Relevanssi index would need updating, with code in the child theme 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);
        relevanssi_index_doc($id, true, relevanssi_get_custom_fields(), true);
    }

    Trevor
    Participant

    You should be able to use a filter in WP All Import to do this.

    Add something like this in the child theme 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);
    }

    Do a test import of a post and see if it has been added to the cache.

    #234484

    In reply to: Post in Search page


    Anonymous
    Inactive

    Thank you for the advice. I created the themify-shoppe-child folder with style.css and functions.php files.
    The content of functions.php is: (and looks like it’s working!). Thanks.

    <?php
    /**
    ** activation theme
    **/
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
     wp_enqueue_style( 'parent-style', get_template_directory_uri() . 'https://cdn2.wpformation.com/style.css' );
    
    }
    add_action('multilingualpress.metabox_after_update_remote_post', 'mlpress_post_saved', 10, 2);
    
    function mlpress_post_saved($relationshipContext, $post) {
        $post_ID = $post->ID;
        do_action('search_filter_update_post_cache', $post_ID);
    }
    #234239

    In reply to: Post in Search page


    Anonymous
    Inactive

    For the moment it seems that it works even if I didn’t add this code. Do I let like it is or do I have to change something? Because I don’t think that a use a child theme. Thanks

    add_action(‘multilingualpress.metabox_after_update_remote_post’, ‘mlpress_post_saved’, 10, 2);

    function mlpress_post_saved($relationshipContext, $post) {
    $post_ID = $post->ID;
    do_action(‘search_filter_update_post_cache’, $post_ID);

    #234237

    In reply to: Post in Search page


    Trevor
    Participant

    Ah, I think I see. He is saying that $post is the entire post array of data, so …

    add_action('multilingualpress.metabox_after_update_remote_post', 'mlpress_post_saved', 10, 2);
    
    function mlpress_post_saved($relationshipContext, $post) {
        $post_ID = $post->ID;
        do_action('search_filter_update_post_cache', $post_ID);
    }

    So, that, from what they say, should work.

    You should be using a child theme, and place that code at the end (on a new line) of the functions.php file you would find i the child theme folder.

    Then test it by importing a post and see if it appeared in the search results.

    #234027

    In reply to: Post in Search page


    Trevor
    Participant

    So, what I gave you changes (very slightly) to this, maybe:

    add_action('multilingualpress.metabox_after_update_remote_post', 'mlpress_post_saved', 10, 2);
    
    function mlpress_post_saved($relationshipContext, $id) {
        do_action('search_filter_update_post_cache', $id);
    }

    But, I have no idea how that $relationshipContext is used.

    Can you show me what is in that file:

    src/multilingualpress/TranslationUi/Post/MetaboxAction.php

    Maybe upload that file to a file sharing site and share the link with me?

    #233980

    In reply to: Post in Search page


    Trevor
    Participant

    Are they able to give an example usage? My first thought would be something like this in the child theme functions.php file:

    add_action('multilingualpress.metabox_after_update_remote_post', 'mlpress_post_saved', 1000, 1);
    
    function mlpress_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
    }

    But only they can confirm precise usage. I cannot find any reference on Google.

Viewing 10 results - 21 through 30 (of 89 total)