Title: [Plugin: polylang-slug AND Polylang]
Last modified: August 30, 2016

---

# [Plugin: polylang-slug AND Polylang]

 *  Resolved [heymATIN](https://wordpress.org/support/users/heymatin/)
 * (@heymatin)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/plugin-polylang-slug-and-polylang/)
 * I encountered a problem…
 * I used this code:
 *     ```
       add_filter('pre_get_posts', 'get_default_language_posts');
   
       function get_default_language_posts($query) {
           if ($query->is_main_query() && function_exists('pll_default_language') && !is_admin()) {
               $terms = get_terms('post_translations'); //polylang stores translated post IDs in a serialized array in the description field of this custom taxonomy
               $defLang = pll_default_language(); //default lanuage of the blog
               $curLang = pll_current_language(); //current selected language requested on the broswer
               $filterPostIDs = array();
               foreach ($terms as $translation) {
                   $transPost = unserialize($translation->description);
                   //if the current language is not the default, lets pick up the default language post
                   if ($defLang != $curLang)
                       $filterPostIDs[] = $transPost[$defLang];
               }
               if ($defLang != $curLang) {
                   $query->set('lang', $defLang . ',' . $curLang);  //select both default and current language post
                   $query->set('post__not_in', $filterPostIDs); // remove the duplicate post in the default language
               }
           }
           return $query;
       }
       ```
   
 * To mix Posts – the default language with the current language.
 * Since I am using Polylang-slug from grappler: [https://github.com/grappler/polylang-slug](https://github.com/grappler/polylang-slug)
 * It does not work anymore,.. is there any work around? Cuz both are needed !!

Viewing 1 replies (of 1 total)

 *  Thread Starter [heymATIN](https://wordpress.org/support/users/heymatin/)
 * (@heymatin)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/plugin-polylang-slug-and-polylang/#post-6412019)
 * solved/worked on
 * [https://github.com/grappler/polylang-slug/issues/10](https://github.com/grappler/polylang-slug/issues/10)

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: polylang-slug AND Polylang]’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [heymATIN](https://wordpress.org/support/users/heymatin/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/plugin-polylang-slug-and-polylang/#post-6412019)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
