Forums › Forums › Search & Filter Pro › "As an Archive" Not displaying results
Tagged: broken form, No results
- This topic has 5 replies, 2 voices, and was last updated 9 years, 7 months ago by
Ross.
-
Ross Moderator(Private) January 15, 2016 at 6:44 am #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
orquery_posts
These are all tell tale signs of overwriting the main WP query, and in effect overwriting the the search results.
Thanks
Anonymous(Private) January 20, 2016 at 6:09 pm #34840Unfortunately 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!
AdamAnonymous(Private) February 10, 2016 at 2:30 am #36622I 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(Private) February 10, 2016 at 12:14 pm #36639Glad to hear and thanks for the update.
-
AuthorPosts