if(function_exists('pll_current_language')) // if polylang { add_action( 'pre_get_posts', 'include_language' ); function include_language( $query ) { if ( $query->is_main_query() ) { //add more condition here if needed $query->set( 'lang', pll_current_language('slug') ); } } }