• Hi,
    I need some help with a query.

    Here is my code :

    
    $args = array(
    	'posts_per_page'	=> -1,
    	'post_type'		=> 'transfer',
    	'lang'			=> 'fr',
    	'tax_query'		=> array(
    		'relation'	=>'AND',
    		array(
    			'taxonomy' =>'city-to',
    			'field'		=> 'slug',
    			'terms'	=> array('grenoble')
    		)
    	)
    );
    $query =  new \WP_Query($args);
    

    The array in terms field contain only term slug in “fr” lang, whatever if i am in english or french page.

    This works perfectly fine if i am on an french page. He find all the post.

    But when i am in english page, this not working and the query can’t find any post.

    What i want to do is find all the post only in french. If i do this :
    $args = array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘transfer’,
    ‘lang’ => ‘fr’,
    );
    `

    It works perfectly in all lang, “fr” and “en”. But when i add the tax_query array in my $args it does not work anymore only on “en” page.

    I use polylang plugin and all help will be great.
    Thanks

    • This topic was modified 7 years, 3 months ago by azralth.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with wp_query and polylang’ is closed to new replies.