Forums › Forums › Search & Filter Pro › Initial WP_Query with Polylang showing double items (EN + NL)
Tagged: polylang
- This topic has 3 replies, 3 voices, and was last updated 4 years, 10 months ago by Ross.
-
Anonymous(Private) January 7, 2020 at 5:23 pm #230221
Hi Support,
My initial WP_Query with Polylang is showing double items (EN + NL). After filtering the right items (EN or NL) per language are shown correctly.
English: https://lacourdesparfums.com/en/products
Dutch: https://lacourdesparfums.com/productenI read the documentation carefully and can’t seem to find a the right solution. I tried the following solution as a last resort:
$queryArgs = array( 'post_type' => 'product', 'posts_per_page' => -1, 'orderby' => array('menu_order' => 'ASC', 'title' => 'ASC'), 'has_password' => false, 'paged' => get_query_var('paged') ? absint(get_query_var('paged')) : 1, // Without this the filtering won't work: //'search_filter_id' => 132846, ); //Experiment to make the search_filter_id unique per language: if(pll_current_language() == 'nl') : $queryArgs['search_filter_id'] = 132846; elseif(pll_current_language() == 'en') : $queryArgs['search_filter_id'] = 187211; endif; $items = new WP_Query(array_merge($queryArgs));
Could you please help me in the right direction?
Anonymous(Private) January 9, 2020 at 10:10 am #230470Hi Trevor, thanks for your reply. I changed the setting of the Display results method to ‘WooCommerce Shop’ and the query back to the default WooCommerce query with:
while ( have_posts() ) : the_post();
Still do I get dutch products on the english archive-product and vice versa…
Any idea why the products are cross language shown? Without Search & Filter Pro, it works like expected.
Ross Moderator(Private) January 9, 2020 at 6:42 pm #230547Hi Rogier
Trevor asked me to take a look a this.
I did some tests with Polylang and S&F and all seems to be working ok from my side.
However I haven’t tested with WC also..
After installing Polylang and WC, I get a notification that I should install
Polylang for WooCommerce
https://polylang.pro/downloads/polylang-for-woocommerce/Do you have this plugin installed?
Thanks
-
AuthorPosts