Forums › Forums › Search & Filter Pro › Values from custom fields not being found
- This topic has 15 replies, 3 voices, and was last updated 10 years, 10 months ago by
Ross.
-
Anonymous(Private) December 7, 2015 at 11:13 am #31588
Hello. I have tried several display post options in the S & F Pro, but all including the ‘Using a shortcode’ do not find the posts based on values within custom fields.
I have set the form up to use the following fields: search, categories (‘or’ relationship), and submit. Even if I use the basic search and submit, it is not working.
If I leave the keyword search blank, and select a category that shows it has post counts, search results are 0.
Post types are: built in Posts, Pages and my custom post Activities.
Test build site here: http://scienceforaustralia.com/
Please help as this is getting very frustrating.
Ross Moderator(Private) December 7, 2015 at 11:23 am #31591Hi Alison
It simply looks like you didn’t fill out your Results URL correctly
Thanks
Anonymous(Private) December 7, 2015 at 11:31 am #31593Hi Ross.
Please look here: http://scienceforaustralia.com/search-and-filter/?_sft_category=agricultural-and-veterinary
You will see that there are 2 posts under the category ‘agricultural-and-veterinary’, but they don’t show.
When I use the keyword ‘Econnect’ which is in one of the posts under the category, it doesn’t find it either.
I have double checked the Results URL and it displays as per the documentation.
Ross Moderator(Private) December 7, 2015 at 11:34 am #31594Hi Alison
That seems to be working better now (as in there isn’t a 404).
But you’re right obviously there seems to be an issue with the actual results.
Do you have auto count enabled? If not, can you enable it?
Thanks
Ross Moderator(Private) December 7, 2015 at 11:47 am #31597Hi Alison
The reason for using auto count is to get an idea what is going on under the hood – auto count is the most accurate way to see what S&F is seeing.
So when there are no categories, it means S&F is not finding any results with categories under the current conditions.
There are 2 things that could be happening –
1) Your settings are causing conflicts with your results. This actually happens quite a lot.
Check the Post Meta tab and the Tags, Categories and Taxonomies tab – clear out all and any settings here – do you get results?
Check the Posts tab, are you using any post meta for sort order? If so, use defaults settings.
2) The Search & Filter cache is not being built – which we can look into once we exhaust the above options.
Thanks
Anonymous(Private) December 7, 2015 at 11:57 am #31598Thanks Ross for your help with this. Everything is clear – nothing set under Advanced, Post Meta, Tags, Cats & Taxonomies. Under Posts, I have only ‘Published’ selected.
To display the custom fields on my site, I am using this function:
add_filter('pre_get_posts', 'query_post_type'); function query_post_type($query) { if(is_category() || is_tag()) { $post_type = get_query_var('post_type'); if($post_type) $post_type = $post_type; else $post_type = array('post', 'activity'); // activity is custom post type $query->set('post_type',$post_type); return $query; } }If I go to the shortcode results page: http://scienceforaustralia.com/search-and-filter/
it lists all the posts as ‘All categories’.Ross Moderator(Private) December 7, 2015 at 12:23 pm #31599Hey Alison
I think you might have hit the nail on the head.
pre_get_postswill likely be modifying the search queries.What happens when you remove this code, and any other
pre_get_postsyou might have?Thanks
Anonymous(Private) December 7, 2015 at 12:33 pm #31600Hi Ross. I have just removed the added function(s) that were displaying my custom fields on my site. However, it has not cured the S&F issue. See here still: http://scienceforaustralia.com/search-and-filter/
If I enable Auto Count, it still shows no categories. I I disable it, it shows that there are in fact categories, but they are not being displayed.
-
AuthorPosts