Get WPFTS Pro today with 25% discount!

  • Hi! Sometimes new WPFTS users may notice the strange behavior of the WPFTS search: it works fine in the Sandbox, but the frontend search either makes 0 results, or only the first page of results is present, while the next pages are completely empty.

    This behavior can be the result of the Polylang plugin feature (?) which filters posts by the language taxonomy, so only specific posts/pages (that have the assigned language equals to the current language) can be found at the frontend. All other posts/pages (and attachments too) that have no assigned language will be not found at all.

    We made a simple addon which blocks this Polylang "feature" and allows all posts/pages to be searched at the frontend.

    The code is below.

    add_action('pre_get_posts', function($wpq)
    	if ($wpq->is_main_query() && $wpq->is_search) {
                    // Only execute the code below on frontend main search
                    $wpq->tax_query = new WP_Tax_Query( array() );
    		$wpq->set('lang', '');
    		$wpq->set('tax_query', '');
    }, 99, 1);

    You can download it also if you not a pro in coding and/or just don't want to patch theme files.