WPML : Get The Posts Of Current Language

Recently I’m working on of client project where I  used WPML plugin to make the site multilingual.  One of the problem I’m facing with this, when I fetch the posts by using the  <?php get_posts( $args ) ?> . It always returns the posts of all language. Where I want only the posts of the current language.

After digging deeper I finally found the reason. There is one argument of called “suppress_filters” which is true by default and it disabled all extra filters in the query. If you set is as false, the query will only get the posts of the current language.

 

Related posts:

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *