Title: API language selection
Last modified: May 12, 2022

---

# API language selection

 *  Resolved [Julien](https://wordpress.org/support/users/emael76/)
 * (@emael76)
 * [4 years ago](https://wordpress.org/support/topic/api-language-selection/)
 * Hello there,
 * I have a request for one of my client. I had to code a plugin that allows him
   to chose any post (including CPTs) from gutenberg inside a custom block. He now
   asks me if it would be possible to use polylang to filter the list of posts based
   on its language. I can’t seem to find anything when I log my getEntityRecords
   about language (except the slug that I could parse but it’s not great…).
 * My question is : is it possible to get language listed inside getEntityRecords
   with the pro version ? Also is it possible to get the language of the page in
   which the user is loading my custom block ?
 * I’d like to have something like this :
 *     ```
       	const posts = useSelect<Post[] | null>(select =>
       		select("core").getEntityRecords("postType", post_type, {
       			per_page: 99,
       			language: "fr",
       		})
       	);
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [Julien](https://wordpress.org/support/users/emael76/)
 * (@emael76)
 * [4 years ago](https://wordpress.org/support/topic/api-language-selection/#post-15640946)
 * Just found out that you need PRO for this.
    Basically buy the PRO version then
   you can call getEntityRecoards and get language :
 *     ```
       const posts = useSelect<Post[] | null>(select =>
       		select("core").getEntityRecords("postType", post_type, {
       			per_page: 99,
       			lang: selectedLanguage,
       		})
       	);
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘API language selection’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Julien](https://wordpress.org/support/users/emael76/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/api-language-selection/#post-15640946)
 * Status: resolved