Forums Forums Search & Filter Pro Post in Search page

Viewing 10 posts - 11 through 20 (of 24 total)
  • Trevor
    #234027

    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?

    Anonymous
    #234031
    This reply has been marked as private.
    Trevor
    #234039

    Our email server will probably strip any attachment, sorry.

    Anonymous
    #234047
    This reply has been marked as private.
    Trevor
    #234051
    This reply has been marked as private.
    Anonymous
    #234065
    This reply has been marked as private.
    Trevor
    #234069
    This reply has been marked as private.
    Trevor
    #234163

    The file it was in was MetaboxAction-POST-file.php, but it is not obvious what to use $relationshipContext for. It may not be necessary, I don’t know.

    Show them the code I last gave you and see if they can correct it?

    Anonymous
    #234233

    Hello Pauline,

    Thank you for contacting us.

    In my previous reply I described in details how to use the filter ;
    add_action(‘multilingualpress.metabox_after_update_remote_post’, function($relationshipContext,$post ){
    //here you can do your staff
    // you have $post array
    // you have $relationshipContext with the posts connected to each other
    // the action can be found in src/multilingualpress/TranslationUi/Post/MetaboxAction.php
    },10,2);
    they don’t have the $id for the second parameter, they have entire $post array, so the $id they can get from that array.

    best regards,
    Narek

    Trevor
    #234237

    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.

Viewing 10 posts - 11 through 20 (of 24 total)