Values from custom fields not being found

Forums › Forums › Search & Filter Pro › Values from custom fields not being found

Viewing 10 posts – 1 through 10 (of 16 total)
  • Anonymous
    #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
    #31591

    Hi Alison

    It simply looks like you didn’t fill out your Results URL correctly

    Thanks

    Anonymous
    #31593

    Hi 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
    #31594

    Hi 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

    Anonymous
    #31595

    Hi Ross. Yes, just enabled auto count, but now it is not showing any categories?

    However, I have the native categories widget displayed just below the S&F search widget in left-hand sidebar, there are custom posts under these categories.

    Ross Moderator
    #31597

    Hi 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
    #31598

    Thanks 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
    #31599

    Hey Alison

    I think you might have hit the nail on the head.

    pre_get_posts will likely be modifying the search queries.

    What happens when you remove this code, and any other pre_get_posts you might have?

    Thanks

    Anonymous
    #31600

    Hi 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.

    Ross Moderator
    #31685
    This reply has been marked as private.
Viewing 10 posts – 1 through 10 (of 16 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.