Tag Info

New answers tagged


Your problem is that you are not resetting all the needed query variables, like WP_Query::$is_page, WP_Query::$is_single and WP_Query::$is_archive. Also note that 'pre_get_posts' is fired for all queries, the main and the secondaries, so you should check that you are working on the main query. Finally, when you get data from $_GETyou should sanitize it ...


Try the following: public static function pre_get_posts($query) { if( !isset($_GET['tag-search']) || !isset($_GET['terms']) ) return $query; if ( ! is_admin() && $query->is_main_query() ) { if( strtolower( $_GET['method'] ) == 'and' ) { $query->set( 'tax_query', array( array( ...

Top 50 recent answers are included