Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

When creating and editing your theme’s PHP templates, you can list posts by using the get_posts function. By default, this function will return all posts for every language. To return only posts for the current language, you have two options. First is to set the 'suppress_filters' of the get_posts function to false. The second, preferred option is to return posts using the query_posts function instead.

If you choose to use the get_posts function, consider the following code snippet as an example: $args = array( // all your other arguments here 'suppress_filters' => false ); $posts_array = get_posts( $args );

100% of people find this useful.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 8 replies, has 6 voices.

Last updated by Vitalii Kaplia 9 years, 4 months ago.

Assigned support staff: Harshad.

Author Posts
May 1, 2012 at 4:50 pm #57511

Teng Shui

Hi, in my custom development work to my theme, I am using get_posts api. My problem here is it return all the posts for every language. I want it return only the posts of current view language, what should I modify for it to work? Thanks.

May 1, 2012 at 5:11 pm #57513


Add suppress_filters=0 as an argument to your get_posts() query

May 3, 2012 at 2:02 am #57685

Teng Shui

Thanks. It's works.

June 12, 2012 at 8:04 pm #62865


What if I have to access a single post using get_post( $post_id, $output );
Thanks in advance. 🙂

June 14, 2012 at 9:39 am #63117

Jean Paul

can you show an exemple with get_post and suppress_filters?
is it get_post( $post_id, suppress_filters = 0) ?

June 14, 2012 at 9:56 am #63119


I have already got solution for this. Since this topic was "Resolved" I thought its better to put it as a new one.

get_post(icl_object_id($element_id, 'post_type', false));
get_post_meta(icl_object_id($element_id,'post_type',false,ICL_LANGUAGE_CODE), '_sample_key', true);

More related info here.

Initially, the documentation is difficult to read but once you get gist of it along with this topics on this forum, it's really helpful.

June 14, 2012 at 9:59 am #63120

Jean Paul

Thanks a lot, it's more clearer 🙂

January 31, 2014 at 8:43 am #330957


Hi Jesh,

I do not understand where you apply get_post(icl_object_id($element_id, 'post_type', false));.

I am using at the moment... $myposts = get_posts( $args );

June 5, 2019 at 12:35 am #3955907

Vitalii Kaplia

Thanks, it works!