Forums Forums Search & Filter Pro No results when searching for all post types

Viewing 7 posts - 11 through 17 (of 17 total)
  • Ross Moderator
    #32141

    Hi Manuel

    Ok so it looks like you have some code somewhere that is being too greedy and affecting queries with custom post types.

    Basically, its probably a greedy pre_get_posts filter or another plugin (or possibly your theme) thats causing the issue.

    I would start by disabling all your plugins and see if it starts working.

    If not, I would test on a default WP theme as it could be here.

    Once we know where the issue is then we can get it working.

    Anonymous
    #32210

    Hi,

    but it doesn’t even work when I remove all filters. Right now I have only the search input field. When I search for “pasta”, no results appear. But there should be a few.

    Best regards
    Manuel

    Anonymous
    #32216

    I checked all plugins and it seems that Search & Filter interferes with The Events Calendar. I need both, so currently I’m looking into the calendar plugin.

    Anonymous
    #32219

    I found something, maybe you can have a look at it:

    In the Query.php of The Events Calendar plugin I commented out the statement if ( $query->tribe_is_multi_posttype ) and everything in it. Now the search and filters work fine.

    Anonymous
    #32220

    I could shrink the problem down to these two lines. I disabled them for now:

    add_filter( 'posts_fields', array( __CLASS__, 'multi_type_posts_fields' ), 10, 2 );
    add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
    Ross Moderator
    #32222

    Hi Manuel

    It seems that plugin is adding on filters to queries its not supposed to.

    If you were to create a new WP_Query somewhere in your theme, for creating custom loops or anything like that, then this plugin would modify that query – and that shouldn’t be happening.

    I can see its a very popular plugin, but, I’m sure that this is wrong.

    It should only add filters to queries that it needs to modify – not all queries.

    S&F actually used to do this by mistake in a very old version – and interfere with other queries that S&F should not be using. This was because the filter was not removed after it was added.

    The solution is to remove the filter – something like:

    remove_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );

    Do you see that anywhere in the plugin code?

    Thanks

    Anonymous
    #32227

    Hi Ross,

    thanks for your answer. I didn’t find the remove_filter(), but for now I just commented it out and it works for me. I don’t know if you wanna get in contact with them (from developer to developer) or if they’ll remove it anyway. But for me, this workaround works.

    Best regards
    Manuel

Viewing 7 posts - 11 through 17 (of 17 total)