Forums › Forums › Search & Filter Pro › Post in Search page
- This topic has 24 replies, 2 voices, and was last updated 4 years, 8 months ago by Trevor.
-
Trevor(Private) February 18, 2020 at 2:57 pm #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.
Anonymous(Private) February 18, 2020 at 3:07 pm #234239For 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);Trevor(Private) February 18, 2020 at 3:21 pm #234243Be careful if you do not use a child theme. any files you edit, such as the functions.php file and the style.css file (and any template files you make or edit), will be overwritten and lost with new versions if you update the theme. Using a child theme avoids this.
Also be careful copying code from our forum. You will notice that I post code inside a code box in the posts(use a back tick before and after the code)? Code you see in an open post and in emails will have been altered (characters changed), so be wary.
Anonymous(Private) February 20, 2020 at 2:56 pm #234484Thank 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); }
-
AuthorPosts