Resolved

Resolved in: 4.3.4

Symptoms

This issue will occur when those 3 conditions are true:

  • The site uses “Different languages in directories” as a language format
  • The “Use directory for default language” option is checked
  • The site is NOT installed in a subdirectory, e.g. “http://mysite.com”Then the REST API is not available under URL “http://mysite.com/YOUR_DEFAULT_LANG/wp-json” but is still visible under “http://mysite.com/wp-json”.

Workaround

In order to temporary fix it, you will need to modify WPML_URL_Converter_Subdir_Strategy::is_use_directory_for_default_lang_enabled in this way:

public function is_use_directory_for_default_lang_enabled() {
   return $this->use_directory_for_default_lang;
}

Do not apply this temporary fix if your site is installed in a subdirectory: e.g. “http://mysite.com/dev”. In such a case, the current code works correctly.

We are working on a permanent fix and it’ll be included in one of our next versions.

One Response to ““Use directory for default language” does not work with REST API”