Title: Display default language post
Last modified: August 22, 2016

---

# Display default language post

 *  [esqualli](https://wordpress.org/support/users/esqualli/)
 * (@esqualli)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/display-default-language-post-1/)
 * Hi all!
 * I’m creating a website with multi language but the customer only wants the posts
   in the default language that is Spanish, all the website was on Catalan, Euskera,
   Galego, English, French and Italian.
 * I’ve followed the instructions in the [documentation](https://polylang.wordpress.com/documentation/documentation-for-developers/tips-and-tricks/how-to-display-the-default-language-post-if-the-translation-does-not-exists/)
   page of Polylang that refers to the Syllogic consultants [thread](http://wordpress.syllogic.in/2014/08/going-multi-lingual-with-polylang/).
   I’ve done pasted the code in that page to my functions.php and then the page 
   shows in blank, the admin and the front-end too.
 * Can anyone help me with this trouble?
 * Thanks!
 * [https://wordpress.org/plugins/polylang/](https://wordpress.org/plugins/polylang/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [esqualli](https://wordpress.org/support/users/esqualli/)
 * (@esqualli)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666615)
 * Hi!
 * Can anyone could help me with the trouble of showing posts only in the default
   language?
 * Thanks!
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666616)
 * Hi!
 * > I’ve done pasted the code in that page to my functions.php and then the page
   > shows in blank, the admin and the front-end too.
 * You probably did something wrong. Blank page generally means a fatal error. Set
   WP_DEBUG to true in wp-config.php to display errors (don’t forget to set it to
   false once the problem is solved).
 *  Thread Starter [esqualli](https://wordpress.org/support/users/esqualli/)
 * (@esqualli)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666619)
 * This is what the debug returned
 *     ```
       Notice: Use of undefined constant E_USER_DEPRECATED - assumed 'E_USER_DEPRECATED' in /usr/home/suvisa/www/wordpress/wp-content/plugins/codestyling-localization/codestyling-localization.php on line 2491
   
       Notice: Trying to get property of non-object in /usr/home/suvisa/www/wordpress/wp-content/themes/kallyas/header.php on line 147
       ```
   
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666623)
 * Strange. Notices should not break the site. Only errors can leave a site blank.
   Sorry this cannot help to find out what’s wrong.
 *  Thread Starter [esqualli](https://wordpress.org/support/users/esqualli/)
 * (@esqualli)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666634)
 * I don’t know why but now does not show the blank page, but still doesn’t show
   the default post…
 * The code i put in the functions.php with the Functionality plugin is this:
 *     ```
       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;
       }
       ```
   
 * Thanks for your help!
 *  Thread Starter [esqualli](https://wordpress.org/support/users/esqualli/)
 * (@esqualli)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666643)
 * So… anyone could help me? Anyone needs to use the default language instead of
   the secondary ones?
 * Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Display default language post’ 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/)

## Tags

 * [default language](https://wordpress.org/support/topic-tag/default-language/)

 * 6 replies
 * 2 participants
 * Last reply from: [esqualli](https://wordpress.org/support/users/esqualli/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/display-default-language-post-1/#post-5666643)
 * Status: not resolved