Hey there, it looks like you've been redirected from designsandcode.com - as you can see we have a new home - read more
Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › new posts are not showing in search results
- This topic has 17 replies, 3 voices, and was last updated 6 years, 4 months ago by Ross.
-
dann hanks(Private) December 5, 2017 at 12:08 pm #145709
Hi, I have a really odd problem with search and filter results.
My site allows users to upload a custom post ‘property’.
When they upload the property, it will not show in the search and filter results. It’s odd as the internal search of the website finds it as soon as it’s published. Logging in as admin shows the property post that they have uploaded as published, it just wont display in search and filter results.
I have noticed also that if I log in as admin and edit their post slightly and update it, shows up on the results, for some reason S&F does not like my users posts.
any help will be great.
Trevor Moderator(Private) December 5, 2017 at 1:03 pm #145729The tool that you use to upload the post requires a extra bit of code to trigger the adding of it to our cache.
You can see the documentation here:
dann hanks(Private) December 5, 2017 at 4:05 pm #145785Hi Trevor,
thanks for that, I note this is for a particular post though – I would need it to cover all posts that users upload… Is that possible? Perhaps by the custom post type?
: )
Dann
Trevor Moderator(Private) December 5, 2017 at 4:07 pm #145791Most post importers tend to use a function to do the import, and that function usually returns the post ID of the new post. You can feed that in to a PHP variable, and then use that instead of the number.
dann hanks(Private) December 5, 2017 at 4:10 pm #145795mmm… I will have to have a delve around and test..
is there no way to add this to functions.php? I don’t really want to have to hack my plugin.
Trevor Moderator(Private) December 5, 2017 at 4:11 pm #145797It is possible IF the author of the importer has provided a filter hook to allow this. You would need to contact them for advice.
dann hanks(Private) December 5, 2017 at 4:33 pm #145818Hi,
I have found the point where the posts are being created, it is done with acf_form (advanced custom fields).
here is the point of creation:
acf_form(array( 'post_id' => 'new_post', 'post_title' => true, 'post_content' => true, 'html_submit_spinner' => '<span class="acf-spinner"></span>', 'fields' => array( 'field_58cbdee51e676', 'field_59275314be48d', 'field_58cbdea81e675', 'field_592761f1f5089', 'field_58cc419adc979', 'field_58cbdf351e677', 'field_58cc4030d72ed' , 'field_58cbe07a1e67f', 'field_58cbe4815ba98', 'field_58cbe4385ba97', 'field_58cbe4255ba96', 'field_5927621af508a', 'field_58f9fb4b79b0f', 'field_5926bf6634841', 'field_5926b208b9016', 'field_58c02d04898e2', 'field_58c02e471efe3', 'field_58c02ec61e011', 'field_592eb6f95b95b' ), 'new_post' => array( 'post_type' => 'property', 'post_status' => 'publish' ), 'return' => home_url('my-account/?profile=all-post'), 'submit_value' => 'Create Property' ));
is this where I would add the “do_action(‘search_filter_update_post_cache’, xx);”?
sorry, a little out of my depth here…
thanks!
Trevor Moderator(Private) December 5, 2017 at 4:39 pm #145820Ah. ACF. we have done a lot of digging with that before. See this post:
https://support.searchandfilter.com/forums/topic/cache-not-updated-automatically/page/2/#post-94346
dann hanks(Private) December 7, 2017 at 3:33 pm #146253Hi Trevor, thanks for pointing me to here, however the fix did not work. I am not sure if I have missed something though, all I have done here is add
function my_acf_save_post( $post_id ) { // bail early if no ACF data if( empty($_POST['acf']) ) { return; } if ((!is_admin()) || (defined('DOING_AJAX') && DOING_AJAX)) { do_action("search_filter_update_post_cache", $post_id); } } add_action('acf/save_post', 'my_acf_save_post', 20);
to my functions file… I have tried to backtrack through this thread to see if something is missing. There are many private messages though so it’s difficult to tell.
Trevor Moderator(Private) December 7, 2017 at 4:38 pm #146272This reply has been marked as private. -
AuthorPosts
You must be logged in to reply to this topic.