Forums › Forums › Search & Filter Pro › Post in Search page
- This topic has 24 replies, 2 voices, and was last updated 5 years, 6 months ago by
Trevor.
-
Trevor(Private) February 17, 2020 at 10:04 am #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(Private) February 18, 2020 at 2:44 pm #234233Hello 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,
NarekTrevor(Private) February 18, 2020 at 2:57 pm #234237Ah, 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.
-
AuthorPosts