I installed Polylang Plugin and configed that but I have a problem when I set the default language in Persian language the site loaded in English mode and it is not deference if change default language because in any way in run site loaded by English version. I installed 3 languages: Persian, English, French Wordpress version is 4.1.1 and Polylang Plugin version is 1.8.5 How can I fixed the default language in fa-IR? please help me
this solution isn't standard! but work for me :)
replace (comment) this line in wp-content/plugins/polylang/frontend/choose-lang.php
file (line 185)
$language = $this->options['hide_default'] && ( ( isset( $_SERVER['HTTP_REFERER'] ) && in_array( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ), $this->links_model->get_hosts() ) ) || ! $this->options['browser'] ) ?
$this->model->get_language( $this->options['default_lang'] ) :
$this->get_preferred_language(); // sets the language according to browser preference or default language
by
$language = 'fa';
For me it was the Polylang setting
Detect browser language (When the front page is visited, set the language according to the browser preference).
Found in wp-admin > languages > settings.
Test to uncheck that.
You can set default language by click on star in Polylang 'Languages' page, there will be a star for default language when someone is visiting your website. Also, don't forget to deactivate detect browser language in Polylang 'Settings' page, I hope this will work. This works fine for me.
this solution isn't standard! but work for me :)
replace (comment) this line in wp-content/plugins/polylang/frontend/choose-lang.php
file (line 185)
$language = $this->options['hide_default'] && ( ( isset( $_SERVER['HTTP_REFERER'] ) && in_array( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ), $this->links_model->get_hosts() ) ) || ! $this->options['browser'] ) ?
$this->model->get_language( $this->options['default_lang'] ) :
$this->get_preferred_language(); // sets the language according to browser preference or default language
by
$language = 'fa';
This is not a perfect solution but works for me. Change the following line in wp-content/plugins/polylang/frontend/choose-lang.php
(Line no 247):
$this->set_language( $language );
to:
$this->set_language( 'ar' ); //set defalt language name.
If someone still having this problem. I had the same issue with Polylang. I was not able to switch back to English after switching to Arabic. The problem had the easiest solution though. It appeared I forgot to set Site Language of WP itself in Settings>General as English UK (it was set to English US). After I changed that all worked fine.
ok i have solution. not need any code. when you set default language then need to go settings - than - URL modifications settings and mark first (The language is set from content) enter image description here
is someone have still problem with this, i found solution. Go to DB > ptqsln_options (you have maybe different prefix) > polylang and at end of json is default_lang and change to your language. It works for me.
I had the same issue. My site was built in Mandarain first. Now, I'm adding English, but Polylang keeps saying the default is English and gives me tons of trouble when adding pages. I've figured out how to fix that.
Go to Language Settings, add the correct "default" language. In my case, Chinese. And double click it then you will see a star on it.
You will also see a star on the first row, the English one, which attaches many pages. And it has a star. Double click to unstar it. Now Polylang will think your default will be the only option soon.
Delete the first English one, which has many pages linked to it. (There's no need to back up.) Don't worry, it won't delete any pages. At this time, you only have one language option for Polylang; in my case, Chinese.
Run the setup wizard again. And you will see Polyland says the site's default language is in Chinese. (Or your correct default one.) Congrats! Now finish the setup as normal.
Go back to the Languages, and add English or the correct intended language back. Then you will see this new English has 0 posts attached to it, and the correct Default Lan has all of the posts to it!
For me it was the language setting for my user (you can set the language there, too). Also check the general language setting, too, of course.
In my case the solution was the correct language code:
My WP installation was set to de_AT. my mistake was that i had chosen the wrong language code (de_DE) for the "Locale" field using the setup wizard.
Under Languages, click on Edit under the language you want to edit in the list. go to the left and enter the right language code in the "Locale" field, hit Update.
Go to Settings > General and change the Site Language to Farsi. That will change the language of the admin part. Is this what you've been looking for?
© 2022 - 2024 — McMap. All rights reserved.