Resolved

Reported for: WPML Multilingual CMS 3.9.0

Resolved in: 3.9.1

Symptoms

In WPML 3.9.0 version, there is a problem in some cases when the site’s default language is not English, with the String Translation and the translation option for the custom post type slug. If you have a custom post type that has a translated slug you might encounter this problem.

WooCommerce Products can also be affected if the slug for Products is translated.

The issue results in a 404 Error Page to be shown or the product to not be available in that language.

Workaround

This issue will be resolved in the 3.9.1 version of WPML.

As a workaround, you can edit the slug-translation/class-wpml-rewrite-rule-filter.php file, found in the ../wp-content/plugins/wpml-string-translation/classes/ folder.

Replace the following code:
if ( $new_match != $match && $display_as_translated_mode )

with this one:
if ( $new_match != $match && ( $display_as_translated_mode || $current_language !== $default_language ) ) {

Afterward, you may have to visit Settings -> Permalinks and click Save Changes without making any changes.

5 Responses to “Custom post type with translated slug or Products may produce error 404 in second language when the second language is English”