Forums Forums Search & Filter Pro "As an Archive" Not displaying results

Viewing 5 posts - 1 through 5 (of 5 total)
  • Ross Moderator
    #34326

    Hey Adam

    This is likely either to do with the setup of the search template or some other plugins/custom code interfering with the search results and the search query.

    The shortcode method is usually more reliable because 3rd party code is less likely to modify those queries, however archive is susceptible to being hijacked because it uses the main WP loop.

    Do you see any custom queries on your template? IE – WP_Query, get_posts or query_posts

    These are all tell tale signs of overwriting the main WP query, and in effect overwriting the the search results.

    Thanks

    Anonymous
    #34840

    Unfortunately I wasn’t able to identify the error. I turned off all the other plugins and I used the basic search.php from the WP TwentyFifteen, but still no results.

    I ended up using the basic WP search with a category limitation as demonstrated here: http://www.wpexplorer.com/limit-wordpress-search/

    Thanks for the help!
    Adam

    Ross Moderator
    #34900

    🙂

    Anonymous
    #36622

    I finally solved this.

    I had a function that excluded a category from the main loop, and it was breaking S&FP.

    // Exclude properties from the main loop
    function exclude_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'cat', '-5' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );
    Ross Moderator
    #36639

    Glad to hear and thanks for the update.

Viewing 5 posts - 1 through 5 (of 5 total)