• Resolved ziozoid

    (@ziozoid)


    Hi,

    first of all sorry for my english and if this question is already answered.

    My website have 5 different languages and I have a page that have to contain all this posts in all the different languages.

    I’m using wp_query like this:

    $type = 'resource';
    			$args=array(
    			  'post_type' => $type,
    			  'lang'=>'',
    			  'post_status' => 'publish',
    			  'posts_per_page' => -1,
    			  'caller_get_posts'=> 1);
    
    			$my_query = null;
    			$my_query = new WP_Query($args);

    And now the query returns me all languages, but if I change lang with en_GB or another language it returns me the same posts.

    I’d like to put the languages selected by user in an array, than filter the posts by languages.

    Do you have any idea?

    thank you

    https://wordpress.org/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    You must not use the locale ‘en_GB’ but the language slug ‘en’ instead.

    Thread Starter ziozoid

    (@ziozoid)

    Hi thanks for the answer !

    I’ve tried en, en_GB, EN, English but do not work.

    If I put the lang in the array with any value (an empty string too) it return me the posts in all languages, if I delete the lang from the array it return me only the current language.

    thanks for your help

    Plugin Author Chouby

    (@chouby)

    I checked again and it works for me.

    Only the correct language slug will enable the filter per language (otherwise it is expected to get all languages).

    Could you check your language slug in Settings->languages?
    Also could you check that your query is not filtered by some interfering function which resets the query vars?

    Thread Starter ziozoid

    (@ziozoid)

    Ok thanks for your answer 🙂

    I had a plugin that was in conflict with polylang. It was displaying by default always all languages, I desactivate that and now all works fine.

    Thank you again..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Retrive custom posts of all languages’ is closed to new replies.