Skip Navigation

Resolved

Resolved in: 4.2.7

Overview of the issue

If you have a category that has a slug that consists entirely of numeric characters this can lead to a redirection loop.

For example, http://example.com/category/1234/ might do a 302 redirect to itself.

Workaround

Edit the class-wpml-query-parser.php file found in the ../wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering folder.

Find the maybe_redirect_to_translated_taxonomy() function.

You should change the following code:

if ( $translated_slugs && $slug !== $translated_slugs[0] ) {

to:

if ( $translated_slugs && $slug != $translated_slugs[0] ) {

2 Responses to “Numerical category slugs can possibly lead to redirection loop”

  1. We’ve run into this issue on a client site.

    We thought about using != but felt that it would not be completely accurate as it would evaluate “0” == “” == false == null. Instead we fixed it in this way:

    if ( $translated_slugs && "{$slug}" !== $translated_slugs[0] ) {

    However, more importantly, we are concerned that a future update will overwrite our changes, so please can you confirm when a fix will be in place for this issue?

    • This is part of the WPML 4.3 development cycle and should be fixed by then.
      Keep an eye on this page to be up to date about this.